Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

no suitable driver 1

Status
Not open for further replies.

Smarty

Programmer
Apr 12, 2001
191
0
0
BE
I want to use database access in my java program, but while running the program, I always get "No suitable driver found"

I guess the class 'sun.jdbc.odbc.JdbcOdbcDriver' is not found. Can someone help me to get this working?

Thanx,
Smarty

 
You should always post your code with these kind of questions....

 
code sections:

import java.sql.*;

[...]

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection(
"jdbc:eek:dbc:kamernet",
"",
"");
Statement stmt = con.createStatement();

ResultSet rs = stmt.executeQuery("SELECT * FROM KHNK_KH_CONTACTPERSOON ");
 
The driver should be part of your default jre/jdk install...

what jdk do you have and what are your classpaths set to?

ksolos
 
I have the jdk1.2.2 and my classpath is set to
c:\classpath (containing mailjars etc)
c:\jdk1.2.2\ (containing src.jar)
I also tried with
c:\jdk1.2.2\lib and c:\jdk1.2.2\jre\lib but none of this works.
 
you have an ODBC data source (DSN) set up properly?
 
I have seen this before, but this also doesn't give me the answer on where these classes should be, how I can see them, or where I can download them

Thanks for your help already,
 
All the jdbcodbc classes are in the rt.jar file. I would explicitly refrence this jar file in your classpath !!

this should work...
 
I caught the classnotfoundexception, and it worked!
Thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top