node-jdbc
JDBC Wrapper for node.js
Latest Version
0.0.13
Support for adding multiple JARs to the classpath has been added. Use the libs array as shown in the initialize section below. As of release 0.0.9, the minimum version of node.js has been increased to v0.10. If you need to use this with node.js v0.8, use version 0.0.8 of node-jdbc.
Please visit node-jdbc for information on installing with npm.
Status
Initialize
var jdbc = new ; var config = libpath: __dirname + 'path/to/jdbc.jar' libs: __dirname + 'path/to/other/jars.jar' drivername: 'com.java.driverclass' url: 'url/to/database' // optionally user: 'user' password: 'secret'; jdbc;
Open Connection, Execute Queries, Close
var { if err console; else if results console; jdbc; }; jdbc;
API
initialize(config, callback)
- see above example for config object
- callback(error)
open(callback)
- opens a new connection
- callback(error)
close(callback)
- closes any existing connection
- callback(error)
executeQuery(sql, callback)
- SELECT commands.
- callback(error, rset)
executeUpdate(sql, callback)
- table modifying commands (INSERT, UPDATE, DELETE, etc).
- callback(error, num_rows) where @num_rows is the number of rows modified