try{
String driverName = "oracle.jdbc.driver.OracleDriver";
Class.forName(driverName);
// Create a connection to the database
String serverName = "127.0.0.1";
String portNumber = "1521";
String sid = "xe";
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + "/" + sid;
String username = "system";
String password = "9868626216";
Connection connection = DriverManager.getConnection(url, username, password);
String query="select * from employee";
Statement st= connection.createStatement();
ResultSet rs=st.executeQuery(query);
System.out.println(rs);
//while(rs.next())
//{
//System.out.println("not 1 empty");
//}
} catch (Exception e) {
// Could not find the database driver
e.printStackTrace();
}
String driverName = "oracle.jdbc.driver.OracleDriver";
Class.forName(driverName);
// Create a connection to the database
String serverName = "127.0.0.1";
String portNumber = "1521";
String sid = "xe";
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + "/" + sid;
String username = "system";
String password = "9868626216";
Connection connection = DriverManager.getConnection(url, username, password);
String query="select * from employee";
Statement st= connection.createStatement();
ResultSet rs=st.executeQuery(query);
System.out.println(rs);
//while(rs.next())
//{
//System.out.println("not 1 empty");
//}
} catch (Exception e) {
// Could not find the database driver
e.printStackTrace();
}
No comments:
Post a Comment