Getting integer from mysql returns always -42...

Discussion in 'Plugin Development' started by IconByte, Mar 23, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    IconByte

    Hello, I am having this kind of MySQL error, any help? :/

    This line is causing it...
    Code:
    ResultSet rs = plugin.getDatabaseManager().query("SELECT * FROM `" + ResultSet rs = statement.executeQuery("SELECT * FROM " + plugin.TABLE + " WHERE username = '" + p.getName() + "';");
     
    Last edited: Mar 24, 2015
  2. @IconByte Well then the username column mustn't exist.
     
  3. Offline

    IconByte

    @bwfcwalshy
    It can be the problem, but I am creating the table and columns on plugin start..? Maybe I am doing it wrong, but it isn't giving me errors.
    Code:
                    Connection c = DriverManager.getConnection(URL, USER, PASS);
                    PreparedStatement statement = c.prepareStatement("CREATE TABLE IF NOT EXISTS `" + TABLE + "` ( `username` varchar(16) NOT NULL, `kills` int(16) NOT NULL, `deaths` int(16) NOT NULL, `wins` int(16) NOT NULL, `losses` int(16) NOT NULL, UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
                    statement.executeUpdate();
                    statement.close();
                    c.close();
    
    --------------------------------------------------------------------------------------------------------------
    //EDIT: Got it working again...
     
    Last edited: Mar 24, 2015
Thread Status:
Not open for further replies.

Share This Page