Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.tintaverificar.mysql;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.util.Calendar;
- import java.util.Date;
- import java.util.concurrent.ConcurrentHashMap;
- import org.bukkit.scheduler.BukkitRunnable;
- import me.tintaverificar.Main;
- public class MySQL {
- private String user;
- private String password;
- private String database;
- private String host;
- private int servidor;
- private Connection connection;
- public MySQL(final String user, final String password, final String database, final String host,
- final int servidor) {
- this.user = user;
- this.password = password;
- this.database = database;
- this.host = host;
- this.servidor = servidor;
- this.setConnection();
- }
- private void setConnection() {
- try {
- Class.forName("com.mysql.jdbc.Driver");
- this.connection = DriverManager.getConnection(
- "jdbc:mysql://" + this.host + "/" + this.database + "?autoReconnect=true", this.user,
- this.password);
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- } catch (SQLException e2) {
- e2.printStackTrace();
- }
- }
- public ConcurrentHashMap<Integer, String> get() {
- try {
- final PreparedStatement stmt = this.connection.prepareStatement("SELECT * FROM website_transactions");
- final ResultSet rs = stmt.executeQuery();
- final ConcurrentHashMap<Integer, String> query = new ConcurrentHashMap<Integer, String>();
- while (rs.next()) {
- boolean ativado = rs.getBoolean("transaction_ACTIVE");
- }
- return query;
- } catch (SQLException ex) {
- ex.printStackTrace();
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement