ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nigel Parker" <nigel.par...@mazeppa.no>
Subject Cant access JDBC driver twice in same Ant run
Date Sun, 25 Nov 2001 21:37:58 GMT

I have recently converted the administration of my Java JDBC application to
Ant, and am very pleased with the new flexibility it gives me. One of the
reasons for doing the conversion was to automate regression tests. I have
however hit on the following problem which eludes all my attempts to get
round:

When I run the application once in a single <target> everything works fine.
When I run the application twice in dependent targets, the second time
always fails with:

java.sql.SQLException: No suitable driver
	at java.sql.DriverManager.getConnection

Ive tried all combinations for loading the driver I can think of, like:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance()
java.sql.DriverManager.deregisterDriver()
java.sql.DriverManager.registerDriver()

I tried inserting the driver name as a system property: <sysproperty
key="jdbc.drivers" value="sun.jdbc.odbc.JdbcOdbcDriver"/>

I tried also java.sql.DriverManager.getDriver("jdbc:odbc:SongFase2") just
before my call to getConnection with an identical URL. The correct driver is
returned so it must be there, but getConnection() in the second application
run still gives me the above exception.

Can someone help me and tell me what am I doing wrong?

thanks
Nigel Parker


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message