Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Connection connectToDatabase(String adress, int port) {
- Properties connectionProps = new Properties();
- connectionProps.put("user", "root");
- connectionProps.put("password", "root");
- try {
- connection = DriverManager.getConnection("jdbc:mysql://" + adress + ":" + port + "/",
- connectionProps);
- } catch (SQLException e) {
- System.out.println("Error when connecting to the database");
- e.printStackTrace();
- }
- return connection;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement