Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

How To work With JDBC Type 2 Driver

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41967
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"));
}
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic