Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class JDBCVersion
- {
- public static void main (String args[]) throws SQLException
- {
- OracleDataSource ods = new OracleDataSource();
- ods.setURL("jdbc:oracle:thin:jdbc/jdbc@localhost:1521/XE");
- Connection conn = ods.getConnection();
- // Create Oracle DatabaseMetaData object
- DatabaseMetaData meta = conn.getMetaData();
- // gets driver info:
- System.out.println("JDBC driver version is " + meta.getDriverVersion());
- }
- }
- String jdbcUrl = "jdbc:oracle:thin:@localhost:1521/XE"
- String userid = "hr";
- String password = "hr";
- Connection conn;
- public void getDBConnection() throws SQLException{
- OracleDataSource ds;
- ds = new OracleDataSource();
- ds.setURL(jdbcUrl);
- conn=ds.getConnection(userid,password);
- }
Add Comment
Please, Sign In to add comment