Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pl.kti.pk2.dbdemo.data;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- public class DBManager {
- private static String _host = "150.254.204.135";
- private static String _port = "3306";
- private static String _user = "pk2_student_01";
- private static String _pass = "100dent;";
- private static String _db = "pk2_01";
- private static Connection connection;
- public static Connection getConnection() throws ClassNotFoundException, SQLException {
- if (connection == null) {
- Class.forName("com.mysql.jdbc.Driver");
- String url = "jdbc:mysql://" + _host + ":" + _port + "/" + _db + "";
- connection = DriverManager.getConnection(url, _user, _pass);
- }
- return connection;
- }
- }
Add Comment
Please, Sign In to add comment