wood burning stoves 2.0*
The moose likes JDBC and the fly likes ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver" Watch "ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver" New topic
Author

ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver

Shrikumar Vadivelu
Greenhorn

Joined: Sep 14, 2005
Posts: 14
Hi,

I am getting following exception:

"java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver".

This is my CODE:
----------------

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc dbc:gsoe", "gsoe", "gsoe");
pstmt = con.prepareStatement("insert into tmp_order (id, order_qty) values (?, ?)");
pstmt.setLong(1, dpci_id);
pstmt.setLong(2, two);
pstmt.execute();

Kindly let me know ur suggestions asap.

Thanks & Regards,
--Sri.
Sripathi Krishnamurthy
Ranch Hand

Joined: Mar 07, 2005
Posts: 232
1)check whether you have the jar file(rt.jar) in classpath accessable to jre.
2)also check whether you are using SUN JRE. If you are using other jre, ODBC bridge driver might not exist.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

...for example it is not included in the IBM JDK which is installed and enabled by default in WebSphere.
Pankaj Shirke
Greenhorn

Joined: Sep 28, 2005
Posts: 4
Hi,
If you are using Sun JRE ,then just put rt.jar in your jre\lib\ext directory or add JAVA_HOME/lib folder in your classpath.
It depends on JVM vendor.If you use jvm other than Sun you won't get JdbcOdbcDriver.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver
 
Similar Threads
can a batch have multiple prepared statements
classnotfoundexception
Making Connection with database
JDBC-ODBC does not work for long datatypes using prepared statements
An JDBC problem