Neeraj
Posts: 1
Nickname: tinku
Registered: Oct, 2002
JDBC Oracle8i connectivity problem
Posted: Oct 9, 2002 3:19 PM
Advertisement
I have jdk 1.2.2 & oracle8i Enterprise server edition, windows2000 Advanced server. I have tried to access the database through JDBC but unable to connect to the database. I have written the code this way. import java.io.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import oracle.jdbc.driver.OracleDriver; public class Employee { public static void main(String[] args) { String empName="Neeraj Kumar Singh"; String userName="scott"; String passWord="tiger"; Connection conn=null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); System.out.println("Connecting to database...Wait..."); conn=DriverManager.getConnection("jdbc:oracle:oci8:@neeraj","scott","tiger"); System.out.println("The connection is succeeded... "); } catch(SQLException e) { System.out.println("SQL State..." + e.getSQLState()); System.out.println("SQL ErrorCode..." + e.getErrorCode()); System.out.println("SQL ErrorCode..." + e.getMessage()); System.out.println("The connection is failed..."); } catch(ClassNotFoundException e) { System.out.println("Class Not Found Exception exception occured..."); } } } It is not actually connecting neither giving error. What is the solution and possible cause?