Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

prolems on loading the oracle thin driver

 
nalluri gowri
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

import java.sql.*;
class SimpleJdbc
{
public static void main(String ar[])
{
try{
class.forName("oracle.jdbc.driver.OracleDriver");
}
catch(Exception e)
{
System.out.println(e);
}
}
}
 
nalluri gowri
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nalluri gowri wrote:
import java.sql.*;
class SimpleJdbc
{
public static void main(String ar[])
{
try{
class.forName("oracle.jdbc.driver.OracleDriver");
}
catch(Exception e)
{
System.out.println(e);
}
}
}
 
Mahender Parkipandla
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What error you come across?
What problem you have faced? You have not given more details?
 
K. Tsang
Bartender
Posts: 3457
14
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you include the ".newInstance()" part?

Class.forName("oracle.jdbc.OracleDriver").newInstance();

More importantly is the JDBC file in the classpath?
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
K. Tsang wrote:Did you include the ".newInstance()" part?

Class.forName("oracle.jdbc.OracleDriver").newInstance();?

This shouldn't be necessary. The driver registers itself when the class is loaded, and Class.forName() causes the target class to be loaded.

More importantly is the JDBC file in the classpath?

That's probably the question here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic