| | |
jdbc connection
![]() |
•
•
Join Date: Aug 2008
Posts: 40
Reputation:
Solved Threads: 0
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:thin
127.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.
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:thin
127.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
- possible to initialize jdbc connection within jar. (Java)
- Can´t make JDBC connection to MS SQL from home? (MS SQL)
- JDBC connection (Java)
- JDBC connection (Java)
Other Threads in the Java Forum
- Previous Thread: Implementing "double buffering" (without "paint()" method)
- Next Thread: Main method how to solve this please any one dr java?
| Thread Tools | Search this Thread |
-xlint add android api applet application applications array arrays automation bank bi binary blackberry bluetooth chat class client code compile compiler component database development digit eclipse equation error event fractal freeze functiontesting game gameprogramming givemetehcodez graphics gui health html hyper ide idea image infinite input int integer j2me java javame javaprojects jetbrains jni jpanel jtable julia learningresources linux list login loop main map method methods mobile myregfun netbeans newbie nonstatic notdisplaying pearl problem program programming project qt recursion scanner screen scrollbar server set sms sort sorting spamblocker sql sqlserver string superclass swing system text-file thread threads tree variablebinding windows xor






