Hi,
I want to get connection to a DB2 database using the driver
COM.ibm.db2.jdbc.DB2XADataSource. I have also included 'db2java.zip' in
the classpath. However I am getting the exception
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Conn.main(Conn.java:44)
The code that I am using (with try/catch removed) is as follows:
String url = "jdbc:db2:sample";
String driver = "COM.ibm.db2.jdbc.DB2XADataSource";
String dbuser = "db2user";
String dbpswd = "password";
Connection con = null;
if (url != null)
{
Class.forName(driver).newInstance();
if (dbuser == null || dbuser.length() == 0)
con = DriverManager.getConnection(url);
else
con = DriverManager.getConnection(url, dbuser, dbpswd);
}
I guess the url also is correct. Could anyone please let me know what
the problem is.
Thanks in advance,
Rakesh.