File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How To work With JDBC Type 2 Driver

 
kiran mohan
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i am getting a problem while using the jdbc Type 2 OCI driver so can you guys help me using this Type 2 driver for connecting to database.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33691
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kiran,
What's the problem? You are going to need to post some more details here so someone can help you. In particular, what error message are you getting?
 
kiran mohan
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne, thanks for your concern, the problem is that i am using Type 2 driver for connecting to Oracle database and i actually don't know the parameters to be passed an how to use it . i have written the following code so could please check it and suggest me the procedural way of doing it.
Could you also suggest whether any environment variables have to be defined to use the Type 2 Driver, because i have checked out some websites which suggested such changes.


String T2_Driver = "oracle.jdbc.driver.OracleDriver";
String T2_URL = "jdbc racle ci8:@TNSname";

try
{
Class.forName(T2_Driver);
Connection con = DriverManager.getConnection(T2_URL,"scott","tiger");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select eno from emp where ename='SCOTT'");
rs.next();
System.out.println("The ENO is "+rs.getString("eno"));
}
 
Bosun Bello
Ranch Hand
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you execute what you have and if it does not work, post the error you are getting here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic