
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","hr","hr");
i have error on above line when i tried following code
Connection con;
Statement stmt;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Connection established");
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","hr","hr");
stmt=con.createStatement();
ResultSet rst=stmt.executeQuery("select * from emptable");
rst.next();
String st=rst.getString(1);
System.out.println(st);
stmt.close();
con.close();
}
catch (Exception e) {
System.out.println(e.getMessage());
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.