java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(DriverManager.java:579) at java.sql.DriverManager.getConnection(DriverManager.java:189) at JdbcTest1.main(JdbcTest1.java:18)
db2java.zip,db2jcc.jar are in my classpath.
kindly give me a solution.
Thanks in advance [ September 22, 2008: Message edited by: loganathan ]
No Suitable Driver, usually mean, that you don't have the correct url. The correct TCP/IP url should be like: "jdbc:db2://host:port/database"
for remote connection. And you should use the com.ibm.db.jdbc.net.DB2Driver with it. Your com.ibm.db.jdbc.app.DB2Driver rely on the local connection and thus, the same code will not work on a remote machine, even with other Windows computer.
As of version 8, IBM moved to a unified driver you should use: com.ibm.db2.jcc.DB2Driver instead. Please check with IBM website for detail.
I did not know that. I assumed as long as the url pattern matches jdbc:db2: then it will pick the right Driver. Also because loganathan mentioned it was working in Windows and not in Linux, it is not possible that you have "\" issues in a URL...
But it looks like dbname in the code snippet does not resolve to any URL as such so in windows (as the DB2 is running locally on windows) the dbname must easily resolve to the type 2 driver connection.
As far as my experience with registering the driver is concerned, I have seen this happening in HSQL, I was getting a No Suitable Driver exception and did not come accross it once I "registered" the Driver with the Driver manager. Also we could have faced this problem because we have different processes exlusively starting/stopping a centralized database. [ September 28, 2008: Message edited by: Raj Chila ]