java.sql.SQLException: The url cannot be null

User 2347372188

10-11-2011 23:07:25

Hello.  I an Exception when I pass a ConnectionHandler to a JChemSearch class when the ConnectionHandler itself was initialized with an option Connection object.  It appears that JChemSearch is trying to make it's own database connection object instead of using the one I passed in.  This is an undesireable behavior.  Is there a way to for JChemSearch to use the passed Connection instead of trying to create its own?  Here is a partial stack trace:


java.sql.SQLException: The url cannot be null
    at java.sql.DriverManager.getConnection(DriverManager.java:554)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at chemaxon.jchem.db.CacheRegistrationUtil.registerCache(CacheRegistrationUtil.java:85)
    at chemaxon.jchem.db.StructureCache.tryRegistration(StructureCache.java:1511)
    at chemaxon.jchem.db.StructureCache.manageRegistration(StructureCache.java:1471)
    at chemaxon.jchem.db.StructureCache.loadIfNeeded(StructureCache.java:957)
    at chemaxon.jchem.db.JChemSearch.loadCacheIfNeeded(JChemSearch.java:2345)
    at chemaxon.jchem.db.JChemSearch.search1(JChemSearch.java:2045)
    at chemaxon.jchem.db.JChemSearch.search(JChemSearch.java:1879)
    at chemaxon.jchem.db.JChemSearch.setRunning(JChemSearch.java:1722)
    at chemaxon.jchem.db.JChemSearch.run(JChemSearch.java:1745)


Thanks.


 


-&

ChemAxon 8407015329

11-11-2011 16:33:12

Hi,


Could you please specify which JChem version are you using? What kind of RDBMS are you using? And what type of JChemtable are you trying to search?


I tried reproducing the issue with our latest release 5.7, but i was unsuccessful. I went through the code parts in the stacktrace you submitted, and i found no traces of a new connection being created. It uses the ConnectionHandler supplied to JChemSearch. Are you sure the ConnectionHandler is not manipulated by another thread?


Is this issue easily reproducible? Are you experiencing this every time you run your code orjust occasionally. Could you supply some sample code example which reproduces the issue?


Regards,


Vencel

ChemAxon 8407015329

11-11-2011 17:02:13

Hi,


I sort of misunderstood the problem you were reporting(I was looking for a new ConnectionHandler, not a raw Connection). Sorry about that.


We need to create a new connection in order to make the registration in a separate transaction. This case is relevant when the connection is not in auto-commit mode. 


There are a couple of ways around this:


- supply a connection with autocommit mode, for the search duration


- you can register the cache using the CacheRegistrationUtil class


Sorry for the misunderstanding,


Vencel

User 2347372188

11-11-2011 17:18:03

That worked.  Thanks.


 


-&