aspose file tools
The moose likes JDBC and Relational Databases and the fly likes Driver problem when using jdbc odbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Driver problem when using jdbc odbc" Watch "Driver problem when using jdbc odbc" New topic
Author

Driver problem when using jdbc odbc

balaji jayaram
Greenhorn

Joined: Aug 10, 2003
Posts: 5
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


Balaji Jayaram<br />Patni Computer Systems
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Consult the JDBC Developer's Guide at OTN.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Where is class.forName()??


Groovy
balaji jayaram
Greenhorn

Joined: Aug 10, 2003
Posts: 5
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

Joined: Feb 27, 2002
Posts: 8919

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Driver problem when using jdbc odbc