Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void connectToDatabase(String user, String password)
- {
- Properties connectionProps = new Properties();
- connectionProps.put("user", user);
- connectionProps.put("password", password);
- try
- {
- this.conn = DriverManager.getConnection("jdbc:oracle:thin:@//admlab2.cs.put.poznan.pl:1521/"
- + "dblab02_students.cs.put.poznan.pl", connectionProps);
- System.out.println("Connection established");
- }
- catch(SQLException ex)
- {
- Logger.getLogger(Main.class.getName()).log(Level.SEVERE,
- "Could not establish connection to database", ex);
- System.exit(-1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement