943,832 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 351
  • Java RSS
Apr 7th, 2009
0

jdbc connection

Expand Post »
I've tried to make connection with oracle database using code:


import java.io.*;
import java.sql.*;

public class dbcon{
public static void main(String[] args) {
try{
String driver="oracle.jdbc.driver.OracleDriver";
Class.forName(driver);

String jdbcURL="jdbc:oracle:thin127.0.0.1:1521:stud";
String username="scott";
String password="tiger";
Connection conn=DriverManager.getConnection(jdbcURL,username,password);
System.out.println("***Connected to the database***");

conn.close();
}catch(ClassNotFoundException e){
System.out.println("could not find the database driver");
}catch(SQLException e){
System.out.println("The sql state=%s"+e.getSQLState());
}
}
}


But I'm getting ClassNotFoundExeption.Please resolve this.
Similar Threads
Reputation Points: 1
Solved Threads: 0
Light Poster
coolbuddy059 is offline Offline
45 posts
since Aug 2008
Apr 7th, 2009
0

Re: jdbc connection

By 29 posts, you should understand how to use [code] [/code] tags.

As for the exception, make sure you have that jar file in your class path.
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 839
Posting Genius
Ezzaral is offline Offline
6,761 posts
since May 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Implementing "double buffering" (without "paint()" method)
Next Thread in Java Forum Timeline: Main method how to solve this please any one dr java?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC