Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class JDBCUtil {
- private static Connection CONNECTION;
- static {
- try {
- Class.forName("org.postgresql.Driver");
- } catch (ClassNotFoundException ex){
- ex.printStackTrace();
- }
- }
- public static Connection getConnection() {
- CONNECTION = null;
- try {
- CONNECTION = DriverManager.getConnection("jdbc:postgresql://localhost:5432/musicLibrary", "postgres", "qwe123");
- } catch (SQLException ex){
- System.out.println(ex.getMessage());
- }
- return CONNECTION;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement