Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package connector;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- /**
- * Created by user on 30.10.2016.
- */
- public abstract class DbConnector {
- public static Connection getDbConnection() {
- Connection connection = null;
- String url = "jdbc:mysql://localhost:3306/lalala";
- String pass = "root";
- String user = "root";
- try {
- Class.forName("com.mysql.jdbc.Driver");
- connection = DriverManager.getConnection(url, user, pass);
- System.out.println(connection);
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- return connection;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement