Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DataSource {
- private static final String USER = "user";
- private static final String PASSWORD = "root";
- private static final String URL = "jdbc:oracle:thin:@localhost:1521:xe";
- public static Connection getConnection(){
- Connection connection = null;
- try {
- Class.forName("oracle.jdbc.driver.OracleDriver");
- connection = DriverManager.getConnection(URL, USER, PASSWORD);
- } catch (SQLException e) {
- System.err.println("Unable to connect");
- } catch (ClassNotFoundException e) {
- System.err.println("No driver");
- }
- return connection;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement