Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Connection connectToDatabaseAsSupplier(String name,String pass) {
- Connection connection = null;
- try {
- Class.forName("com.mysql.jdbc.Driver");
- String dbURL = "jdbc:mysql://localhost/bank";
- Properties properties = new Properties();
- properties.setProperty("user", name);
- properties.setProperty("password", pass);
- properties.setProperty("useSSL", "false");
- properties.setProperty("noAccessToProcedureBodies","true");
- connection = DriverManager.getConnection(dbURL, properties);
- }
- catch (Exception exception) {
- JOptionPane.showMessageDialog(null, "Establising database connection failed", "Error", JOptionPane.ERROR_MESSAGE);
- }
- return connection;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement