Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- import java.util.Properties;
- /**
- * This program demonstrates how to make database connection with Oracle
- * database server.
- * @author www.codejava.net
- *
- */
- public class Main {
- public static void main(String[] args) throws SQLException, ClassNotFoundException {
- Connection conn2 = null;
- String dbURL2 = "jdbc:oracle:thin:c##stops_bd/pocosi12@dsscora12c.aitec.pt:1521:ORA12C";
- //String username = "c##stops_bd";
- //String password = "pocosi12";
- System.out.println("tentar...");
- conn2 = DriverManager.getConnection(dbURL2/*, username, password*/);
- System.out.println("did it");
- if (conn2 != null) {
- System.out.println("Connected with connection #2");
- try {
- if (conn2 != null && !conn2.isClosed()) {
- conn2.close();
- }
- } catch (SQLException ex) {
- ex.printStackTrace();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement