Created
April 18, 2019 15:50
-
-
Save rajasgs/eef6dfa2b838879b9b34b508727f4a24 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