Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

..
Failed to load latest commit information.
README.md
database.cobp
databases.cobp
package.json
server.js
table.cobp

README.md

MySQL Web Sample

CobolScript can access MySQL server using a Node.js module, and listing databases, tables and columns in dynamic web pages.

Setup

Install Node.js.

Then, execute at command line:

npm install

This command installs the mysql module, according to the dependecies described in package.json file.

Run

With the command line:

node server

The output:

Server started, listening at port 8000

The program connects to the MySQL server at localhost and list its database. The server must be running.

In the pages, the code

perform require using "mysql" giving mysql.

loads the mysql module.

Then

local options.

move object to options.
move "root" to user in options.
move "" to password in options.

local connection.

perform createConnection in mysql using options giving connection.

opens the connection.

The code

perform query in connection using "show databases" showdbs.

showdbs section using err, rows, fields.
* ....

pass showdbs as a callback to asynchronous method query in connection. The callbacks accept three parameters.

Something went wrong with that request. Please try again.