Originally posted by Prad Dip:
Just FYI. In Java 6 we would no longer be needing class.forName. Just put the vendor jar in classpath, the JDK will load the driver class.
Can you explain how this should work, since it doesn't work for me.
I connect to MSSQL 2005 using a correct connection string:
jdbc:sqlserver://<host>;DatabaseName=<database> (using the default port 1433)
When I use this in DriverManager.getConnection without loading the class it fails, stating it can't find the driver. If I do load the class manually, no problems.
The JAR file is in my <JRE home>\lib\ext folder, but it also doesn't work when specified on the classpath.
So, what's the magic I'm forgetting?
[ January 03, 2008: Message edited by: Rob Prime ]
Originally posted by Rob Prime:
Ah right, that's the mechanism. I forgot.
Unfortunately, none of my SQL drivers have that, including the just newly downloaded HSQLDB driver. Shame.
Oracle JDBC driver jar have a oracle.jdbc.OracleDriver in the java.sql.Driver. Download file ojdbc6.jar. This is only for those who are using Oracle