Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.ase.CommandCheckerBlocker.DBConnect;
- import java.sql.*;
- public class databaseConnection {
- static private Connection connection;
- public static Connection getConnection() {
- String host = "sql.pebblehost.com";
- String user = "customer_73953";
- String db = "customer_73953";
- String pass = "3497b6f741";
- if (connection == null) {
- try {
- Class.forName("com.mysql.jdbc.Driver");
- connection = DriverManager.getConnection("jdbc:mysql://" + host + "/" + db, user, pass);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- return connection;
- }
- public static void setData(String string) throws Exception {
- databaseConnection.getConnection().createStatement().executeUpdate(string);
- }
- public static ResultSet getData(String string) throws Exception {
- return databaseConnection.getConnection().createStatement().executeQuery(string);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement