Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Driver problem when using jdbc odbc

 
balaji jayaram
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consult the JDBC Developer's Guide at OTN.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is class.forName()??
 
balaji jayaram
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic