Issue to connect to oracle db in Grovvy

User 55ffa2f197

29-10-2012 02:17:28

I am trying to connect to an oracle database in IJC's Grovvy scripting environment such as following


import grovvy.sql.Sql


db = Sql.newInstance('jdbc:oracle:thin:@hostname:1521:chemip', 'uid', 'password','oracle.jdbc.driver.OracleDriver')


I am getting following error.  I suppose it cannot find the driver in the IJC's Grovvy run environment


java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@hpwbls009.pri.bms.com:1521:chemip
 at java.sql.DriverManager.getConnection(Unknown Source)
 at java.sql.DriverManager.getConnection(Unknown Source)
 at groovy.sql.Sql.newInstance(Sql.java:286)
 at groovy.sql.Sql.newInstance(Sql.java:307)
 at groovy.sql.Sql$newInstance.call(Unknown Source)
 at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
 at script13514769634671629941990.run(script13514769634671629941990.groovy:14)
 at com.im.ijc.groovy.impl.AbstractScriptContext.executeScript(AbstractScriptContext.java:165)
 at com.im.ijc.groovy.impl.AbstractScriptContext$1.phase1InRequestProcessor(AbstractScriptContext.java:117)
 at com.im.commons.progress.BackgroundRunner.processTheTask(BackgroundRunner.java:128)
 at com.im.commons.progress.BackgroundRunner$1.run(BackgroundRunner.java:91)
 at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1411)
 at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1991)


 

ChemAxon fa971619eb

29-10-2012 09:44:23

Hi Dong,


see here for info about getting a connection to a database:


http://www.chemaxon.com/instantjchem/ijc_latest/docs/developer/scriptlets/connect_to_db.html


Tim

User 55ffa2f197

29-10-2012 12:44:38

Thanks Tim, it works great. Did not see the article posted in Scriplets page.


Dong