File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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 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 ( {
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:
subject: Database Connection Error
Similar Threads
BMP, Jboss, and mysql configuring
need java logic
help in coding
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
SessionServlet and Login.jsp