Java examples for JDBC:Oracle
get oracle Connection
//package com.java2s; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Main { private static final String DRIVER = "oracle.jdbc.driver.OracleDriver"; private static final String URL = "jdbc:oracle:thin:@Momos_PC:1521:XE"; private static final String USERNAME = "java"; private static final String PASSWORD = "java"; public static Connection getConnection() {// static? Connection conn = null;/* w ww . j a v a2 s . c o m*/ try { Class.forName(DRIVER); conn = DriverManager.getConnection(URL, USERNAME, PASSWORD); } catch (ClassNotFoundException | SQLException e) { e.printStackTrace(); } return conn; } }