Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Database extends PircBot implements Runnable
- {
- private Statement stmt;
- private Connection con;
- private String USERNAME = "admin_ircbot";
- private String PASSWORD = "pazzzzzzzzzzzzzword(nee dezeis fake :p)";
- private String DBNAME = "admin_ircbot";
- private String DBURL = "jdbc:mysql://mattie-systems.nl:3306/" + DBNAME;
- // private ResultSet rs;
- private MyBot bot;
- private java.lang.Thread t;
- private int errorcount = 0;
- private Debug d = new Debug();
- private ResultSet rs;
- public Database(MyBot bot)
- {
- this.bot = bot;
- activateDBconnection();
- t = new Thread(this);
- t.start();
- }
- public void activateDBconnection()
- {
- try
- {
- Class.forName("com.mysql.jdbc.Driver");
- // Define URL of database server for
- // database named mysql on the localhost
- // with the default port number 3306.
- String url = DBURL;
- // Get a connection to the database for a
- // user named root with a blank password.
- // This user is the default administrator
- // having full privileges to do anything.
- con = DriverManager.getConnection(url, USERNAME, PASSWORD);
- // Display URL and connection information
- System.out.println("URL: " + url);
- System.out.println("Connection: " + con);
- // Get a Statement object
- stmt = con.createStatement();
- getUsersFromDB();
- } catch (Exception e)
- {
- genereerCriticalError(e);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment