• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") not working !

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

What may be the reason, that the following could not be compiled on my PC !
Classpath !
File missing !
import java.sql.*;
import java.util.*;
import java.io.InputStream;
public class ConnectMe {
public static void main (String args[]) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch (Exception e) {
System.out.println("Failed to load JDBC/ODBC driver.");
return;
}
}
}

The compiler error is

D:\jdk1.3\ConnectMe.java:11: cannot resolve symbol
symbol : method forName (java.lang.String)
location: class Class
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
^
1 error
Tool completed with exit code 1

Thanks in Advance !
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
May be the version JDK1.3 which you are working on is not installed properly or must be incomplete. B'coz I had tried the same code on my machine and it working fine.
 
shahul hameed
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tejas Kansara:
May be the version JDK1.3 which you are working on is not installed properly or must be incomplete. B'coz I had tried the same code on my machine and it working fine.



Thanks Tejas !
In the initial period of my java learning, I made a class with name "Class". It was causing the problem ! I removed and everything was O.K. !
Appreciate your help.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the last post!
When using Forte is creates generic classes with filename "Class.java".
Deleted it and works great!
 
Hey, sticks and stones baby. And maybe a wee mention of my stuff:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic