my dog learned polymorphism*
The moose likes JDBC and the fly likes How To work With  JDBC Type 2 Driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How To work With  JDBC Type 2 Driver " Watch "How To work With  JDBC Type 2 Driver " New topic
Author

How To work With JDBC Type 2 Driver

kiran mohan
Greenhorn

Joined: Mar 16, 2005
Posts: 18
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

Joined: May 26, 2003
Posts: 31063
    
232

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?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
kiran mohan
Greenhorn

Joined: Mar 16, 2005
Posts: 18
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

Joined: Nov 06, 2000
Posts: 1510
Why don't you execute what you have and if it does not work, post the error you are getting here.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How To work With JDBC Type 2 Driver