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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JDBC-SQLException - No Suitable Driver 1

Status
Not open for further replies.

porto2001

Programmer
Mar 7, 2001
24
PT

No suitable driver appers when i try to connect to database.

I don´t know how to resolve it.

I use JdbcOdbcDriver with MS Access.

I have IIS installed in my computer.
 
What does your code look like? Are you loading the driver (Class.forName(<your driver here>);)?
 
there alot of things that can be wrong?
First start with looking at your code, make sure everything is spelled correctly, if you are using MSAccess your connection should look similar to the following.

try{
String url = &quot;jdbc:eek:dbc:YourDatabaseName&quot;;
Class.forName(&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;);
connect = DriverManager.getConnection(url, &quot;yourusername&quot;, &quot;yourpassword&quot;);

}
catch(ClassNotFoundException cnfex){
cnfex.printStackTrace();
}
catch(SQLException sqlex){
sqlex.printStackTrace();
}
catch(Exception excp){
excp.printStackTrace();
}

If you are using Windows 2000 Proffesional, make sure you create a Data Source name using the administrative tools.

Lastly, be more elaborate on your questions next time. Having the exact error can be useful sometimes :) Java Rocks
 
Perhaps you forgot to set your Data source. Go to control panel, double click on 'ODBC Data Source (32bit), click on 'System DSN' tab, click on the add button, select 'Microsoft Access Driver (*.mdb)', click finish, enter a source name (anything you like.) Then select a database (click on the 'select' button) and click ok.

Within your codes:-

try
{
Class.forName(&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;);
}
catch(ClassNotFoundException cn)
{
System.out.println(cn);
}
try
{
// if you enter 'test' as your database source name it will look like this
Connection myConnection = DriverManager.getConnection(&quot;jdbc:eek:dbc:test);
...
}
catch (SQLException s)
{
s.printStackTrace();
}

Hope this helps,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top