Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.lang.ClassNotFoundException: com.ibm.db2.jdbc.app.DB2Driver

843859Dec 28 2007 — edited Nov 20 2014
hi i wrriten the following java code for database connection.

/*
* Created on Dec 27, 2007
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/

/**
* @author Admin
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/

import java.sql.*;
public class DB2 {
public static void main(String[] args) {

Connection cn;
ResultSet rs;
Statement st;
try
{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
}
catch(ClassNotFoundException se)
{
se.printStackTrace();
System.out.println(se);
}
try
{
cn=DriverManager.getConnection("jdbc:db2:sample","db2admin","admin");
st=cn.createStatement();
st.executeUpdate("create table new(name char(10),age int)");
}
catch(SQLException se)
{
se.printStackTrace();
}
}
}


But i got error like

java.lang.ClassNotFoundException: com.ibm.db2.jdbc.app.DB2Driver

Pls rectify this error........
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 12 2009
Added on Dec 28 2007
7 comments
469 views