Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package client;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- public class DBConnection {
- private static final String DB_CONNECTION = "jdbc:mysql://0.0.0.0:3309/jcfxml_db";
- private static final String DB_USER = "root";
- private static final String DB_PASSWORD = "";
- private Connection connection;
- public DBConnection() {
- try {
- Class.forName("com.mysql.jdbc.Driver");
- } catch (ClassNotFoundException e) {
- System.out.println("Where is your MySQL JDBC Driver?");
- e.printStackTrace();
- return;
- }
- try {
- this.connection = DriverManager.getConnection(DB_CONNECTION, DB_USER, DB_PASSWORD);
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- public Connection getConnection() {
- return connection;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement