This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC 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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
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: 8904

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: 8904

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
 
Similar Threads
dsn less connections
JDBC connection with oracle 10g
creating a WAS client.
java.sql.SQLException: ORA-00020: maximum number of processes (%s) exceeded
Difference between JDBC in 'normal' Java and JSP?