使用jdbc节点模块调用oracle函数

时间:2014-12-25 08:28:06

标签: javascript node.js oracle jdbc

我正在使用jdbc节点模块来连接oracle并调用在那里声明的一些函数。

我将连接配置为:

{
    libpath: './ojdbc6_g.jar',
    drivername: 'oracle.jdbc.driver.OracleDriver',
    url: 'jdbc:oracle:thin:@192.168.1.53:1521:orcl',
    // optionally
    user: 'test',
    password: 'oraclerac'
}

然后,我将该函数调用如下:

var query = "{ call oracleFunction(input) }";

var genericQueryHandler = function (err, results) {
        if (err) {
            console.log(err);
        } else if (results) {
            console.log(results);
        }
    };

jdbc.open(function (err, conn) {

  jdbc.executeQuery(query, genericQueryHandler);

}

我收到了这个错误:

{ [Error: Error running instance method
    java.sql.SQLException: Non supported SQL92 token at position: 3
    at oracle.jdbc.driver.OracleSql.handleODBC(OracleSql.java:1886)
    at oracle.jdbc.driver.OracleSql.parse(OracleSql.java:1733)
    at oracle.jdbc.driver.OracleSql.getSql(OracleSql.java:438)
    at oracle.jdbc.driver.OracleSql.getSqlBytes(OracleSql.java:942)
    at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:197)
    at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1245)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1585)
    at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1810)
    at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:1281)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
] cause: {} }

我不知道该代码有什么问题。

0 个答案:

没有答案