wood burning stoves 2.0*
The moose likes JDBC and the fly likes Making Connection with database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Making Connection with database" Watch "Making Connection with database" New topic
Author

Making Connection with database

yunuss khan
Greenhorn

Joined: Apr 22, 2006
Posts: 17
Hi All,

i m getting below error when i m trying to make conncetion in jsp.

Error occurred java.lang.ClassNotFoundException: jdbc.odbc.JdbcOdbcDriver Error occurred java.sql.SQLException: No suitable driver Error occurred java.lang.NullPointerException

my code is :

Connection conn = null;
ResultSet result = null;
Statement stmt = null;

Class c = Class.forName("jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection("jdbc dbc:master","","");
stmt = conn.createStatement();
result = stmt.executeQuery("SELECT * FROM Employees");

i m using sql 2000.

pls help.

thanks in advance.

yunus
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

The name of the class is "sun.jdbc.odbc.JdbcOdbcDriver", is it not?
yunuss khan
Greenhorn

Joined: Apr 22, 2006
Posts: 17
Thanks Paul...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Making Connection with database
 
Similar Threads
connect my MySQl databse
Accessing Connection pool
Error catching for DataSource
How to connect to mysql database?
In JSP + Jdbc web page can "System.out.println()" can be used?