-
-
Save rajacsp/153e467c764655cf615262d0c3c0e4c7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.rj; | |
import java.sql.*; | |
public class Oracle12CEETest { | |
private final static String DB_URL = "jdbc:oracle:thin:@//127.0.0.1:1521/orcl"; | |
private final static String USER = "system"; | |
private final static String PASS = "oracle"; | |
public static void main(String[] args) { | |
Connection conn = null; | |
try { | |
Class.forName("oracle.jdbc.driver.OracleDriver"); | |
System.out.println("Connecting to database..."); | |
conn = DriverManager.getConnection(DB_URL, USER, PASS); | |
System.out.println("Connected"); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} finally { | |
if (conn != null) { | |
try { | |
conn.close(); | |
} catch (SQLException e) { | |
// ignore | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment