Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- URI dbUri = new URI(databaseUrl);
- String username = dbUri.getUserInfo().split(":")[0];
- String password = dbUri.getUserInfo().split(":")[1];
- String dbUrl = "jdbc:postgresql://" + dbUri.getHost() + dbUri.getPath() + "?user=" + username + "&password="+password+PARAMS;
- databaseConnection = DriverManager.getConnection(dbUrl);
- }
- catch (SQLException | URISyntaxException e) {
- //e.printStackTrace();
- System.out.println("Failed connecting to database");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement