• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ranchers,
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
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
^
Why???
/*
* @(#)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("sun.jdbc.odbc.JdbcOdbcDriver");
//Class.forName("C:\Program Files\JavaSoft\JRE\1.3\bin\Jdbc0dbc.dll");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con = DriverManager.getConnection(url,
"Admin", "duke1");
stmt = con.createStatement();
stmt.executeUpdate(createString);
stmt.close();
con.close();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
}
}

 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is almost always a classpath issue. Check your classpath and make sure that it is set up correctly.
 
reply
    Bookmark Topic Watch Topic
  • New Topic