Advertisement
Guest User

Untitled

a guest
Oct 30th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. public static Connection connection() throws IOException, SQLException {
  2.  
  3.         Properties properties = new Properties();
  4.         InputStream inputStream = null;
  5.  
  6.         inputStream = new FileInputStream("connection.properties");
  7.         properties.load(inputStream);
  8.  
  9.         String DB_URL= (String) properties.getProperty("DB_URL");
  10.         String DB_USER= (String) properties.getProperty("DB_USER");
  11.         String DB_PASS= (String) properties.getProperty("DB_PASS");
  12.  
  13.         Connection conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PASS);
  14.  
  15.         return conn;
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement