agmoyano / node-jasper

JasperReports from Node.js
84 stars 52 forks source link

No support for Oracle database connectivity #79

Open rajeshcbe2000 opened 1 year ago

rajeshcbe2000 commented 1 year ago

Used following settings for Oracle connectivity, jasper = require('node-jasper')({ path: '../jasperreports-5.6.0', reports: { hw: { jasper: '../test.jasper'

        }
},
drivers: {
        oracle: {
            path: '../ojdbc6.jar',
            class: 'oracle.jdbc.OracleDriver',
            type: 'oracle'
        }
},
conns: {
        dbserver1: {
            host: 'hostname',
            port: 1521,
            dbname: 'db',
            user: 'user',
            pass: 'pwd',
            driver: {
                type: 'oracle:thin'
            }
        }
},
defaultConn: 'dbserver1'

});

But the following problem faced calling this 2nd time, please provide a solution for this.

Error: Error running instance method java.lang.AbstractMethodError: oracle.jdbc.driver.OracleConnection.isValid(I)Z at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483)

Daybayzayd commented 1 year ago

Try replace driver: { type: 'oracle:thin' }

with : driver: 'oracle'

rajeshcbe2000 commented 1 year ago

Try replace driver: { type: 'oracle:thin' }

with : driver: 'oracle'

Thank you for your reply, but after replacing the driver type as you said, I'm getting the following error. Please help me to resolve this issue.

Error: Error running static method java.sql.SQLException: Invalid Oracle URL specified at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:285) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:203) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483)

Daybayzayd commented 1 year ago

"Invalid Oracle URL specified"

As the message said, the url is incorrect.

You should replace the information in this code block with your url and credentials. dbserver1: { host: 'hostname', port: 1521, dbname: 'db', user: 'user', pass: 'pwd', }

You should replace the hostname by the host when your database is stored, replace the port, the name of the database (dbname) the user and the password with yours.

Maybe verify if : path: '../ojdbc6.jar', is correct and if you really have the file "ojdbc6.jar" in the location "../" ! ;)

rajeshcbe2000 commented 1 year ago

"Invalid Oracle URL specified"

As the message said, the url is incorrect.

You should replace the information in this code block with your url and credentials. dbserver1: { host: 'hostname', port: 1521, dbname: 'db', user: 'user', pass: 'pwd', }

You should replace the hostname by the host when your database is stored, replace the port, the name of the database (dbname) the user and the password with yours.

Maybe verify if : path: '../ojdbc6.jar', is correct and if you really have the file "ojdbc6.jar" in the location "../" ! ;)

Since I can't share all the information, I've just shared like that. Database is connecting if we give "driver: { type: 'oracle:thin' }", but only problem is DB not getting connected from 2nd time.