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

Driver problem when using jdbc odbc

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am new to Java JDBC. I tried one small program to connect to Oracle database and it results in an error saying "Driver not found"
This is the code snippet I tried:
String url = "jdbc dbc.<dsn>"
Properties p = new Properties();
p.put("UID","scott");
p.put("PWD","tiger");
Connection conn = DriverManager.getConnection(url,p);
String select = "SELECT EMPNO FROM EMP";
PreparedStatement ps = conn.prepareStatement(select);
ResultSet rs = ps.executeQuery();
int empno = rs.getInt(1);
System.out.println(empno);

There may be some syntax error. But this is my logic. I don't know what I missed. I need some suggestion from you.
Thank You
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Consult the JDBC Developer's Guide at OTN.
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where is class.forName()??
 
balaji jayaram
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Lasse and Pradeep for your suggestions.
I need some examples on JDBC using jdbc thin clients and OCI.
Thanks...
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the URL string in your code I find that you are using type 1 JDBC-ODBC bridge. But you talk about thin/OCI drivers and this confuses me. It is better that you start off with a JDBC tutorial.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic