wood burning stoves 2.0*
The moose likes JDBC and the fly likes Database Connection Error 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 "Database Connection Error" Watch "Database Connection Error" New topic

Database Connection Error

Rashmi Dupati

Joined: Mar 05, 2007
Posts: 22

I have used type jdbc driver in my application ...but it's not working...
It's showing some exception...java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

please see the code below.....

boolean login(String userName, String password) {
try {
Class.forName ("oracle.jdbc.driver.OracleDriver");
Connection con =
DriverManager.getConnection("jdbc racle:thin:@","scott","tiger");

System.out.println("got connection");

Statement s = con.createStatement();
String sql = "SELECT UserName FROM Users1" +
" WHERE UserName='" + userName + "'" +
" AND Password='" + password + "'";
ResultSet rs = s.executeQuery(sql);
if (rs.next()) {
return true;
catch (ClassNotFoundException e) {
catch (SQLException e) {
catch (Exception e) {
return false;

Please give the solution to this problem...thanks in advance....
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902

First of all , put this question in JDBC forum section , where many people can answer it .

and for the error, it seems that program is not able to find the specified Oracle driver , so put that jar file which contain Driver code in CLASSPATH.

[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
I agree. Here's the link: http://aspose.com/file-tools
subject: Database Connection Error
Similar Threads
help in coding
BMP, Jboss, and mysql configuring
SessionServlet and Login.jsp
need java logic
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection