CraZySacX / node-jdbc

JDBC Wrapper for node.js
139 stars 106 forks source link

JDBCConn has no method 'initialize' #5

Closed neurotech closed 10 years ago

neurotech commented 10 years ago

Hi

When trying the example code (code here: https://gist.github.com/neurotech/383ff54d651168fd25c6) from the README when connecting to a DB2 database, I get the following error:

/Users/neurotech/tmp/refactor-jdbc/default.js:9
jdbc.initialize(config);
     ^
TypeError: Object function JDBCConn() {
    EventEmitter.call(this);
    this._config = {};
    this._conn = null;
},function JDBCPool(config ){
    var props = java.callStaticMethodSync('java.lang.System', 'getProperties');
//    props.setPropertySync("java.awt.headless", "true");
    _(config.libpath).each(function(p){java.classpath.push(p)});

    console.log(java.classpath);

    var cpds = java.newInstanceSync('com.mchange.v2.c3p0.ComboPooledDataSource');
    cpds.setDriverClassSync(config.drivername);
    cpds.setJdbcUrlSync( config.url );
    cpds.setMinPoolSizeSync(5);
    cpds.setAcquireIncrementSync(5);
    cpds.setMaxPoolSizeSync(20);
    this.cpds = cpds;

    return this;
} has no method 'initialize'
    at Object.<anonymous> (/Users/neurotech/tmp/refactor-jdbc/default.js:9:6)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

How can I get this to work?

CraZySacX commented 10 years ago

Try it now after pulling the latest or grabbing 0.0.3 with npm.

neurotech commented 10 years ago

Thanks for this. The module now works using the example code in the README as a base. Champion.