The moose likes JDBC and the fly likes Help...Problem with Class.forName( 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 "Help...Problem with Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");  " Watch "Help...Problem with Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");  " New topic

Help...Problem with Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Travis Gibson
Ranch Hand

Joined: Oct 17, 2000
Posts: 100
I feel silly for evening asking this question but here it goes.
I keep getting the following message:
CreateCoffees.java:50: cannot resolve symbol
symbol: method forName (java.lang.String)
location: class Class
* @(#)CreateCoffees.java1.2 99/04/23
import java.sql.*;
// Create the Coffee Table.
public class CreateCoffees {
public static void main(String args[]) {
String url = "jdbc dbc:CafeJava";
Connection con;
String createString;
createString = "create table COFFEES " +
"(COF_NAME varchar(32), " +
"SUP_ID int, " +
"PRICE float, " +
"SALES int, " +
"TOTAL int)";
Statement stmt;
try {
//Class.forName("C:\Program Files\JavaSoft\JRE\1.3\bin\Jdbc0dbc.dll");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
try {
con = DriverManager.getConnection(url,
"Admin", "duke1");
stmt = con.createStatement();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());

Regards,<BR>Travis M. Gibson, SCJP<BR>Java Developer<BR>www.travismgibson.com<BR>travis@travismgibson.com
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
This is almost always a classpath issue. Check your classpath and make sure that it is set up correctly.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
subject: Help...Problem with Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Similar Threads
What's wrong with this code?
ClassNotFoundException generated!
No Suitible Driver Error
Access to the Oracle database using Java Applets
Error in connection