MySQL gets always null.

Discussion in 'Plugin Development' started by KingNyuels, Dec 18, 2013.

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

    KingNyuels

    Why is this so?
    There I initialize 'mySQL'
    Code:java
    1.  
    2. public abstract class SQLManager extends ShareManager {
    3. private MySQL mySQL;
    4. private List<String> existingTables;
    5.  
    6. public SQLManager(String hostname, String portnmbr, String database, String username, String password) throws SQLException, IOException, ClassNotFoundException {
    7. mySQL = new MySQL(hostname, portnmbr, database, username, password);
    8. existingTables = new ArrayList<String>();
    9. }


    and here it is null !?:
    Code:java
    1. public SortedList<Object> __LS(String filler, String secondFiller) throws SQLException, ClassNotFoundException, IOException {
    2. SortedList<Object> objects = new SortedList<Object>();
    3. ResultSet res = mySQL.getConn().createStatement().executeQuery(String.format(StandardSQL.SELECT_ALL.getPerformString(), filler));
    4. if (res.first()) {
    5. Blob blob = res.getBlob(secondFiller + "_object");
    6. objects.add(toObject(blob));
    7. while (res.next()) {
    8. Blob nextBlob = res.getBlob(secondFiller + "_object");
    9. objects.add(toObject(nextBlob));
    10. }
    11. }
    12. return objects;
    13. }

    How can I fix it? It is late and I have to finish this today. Can you please help me?
    If you need more code: Just say it!

    KingNyuels
     
  2. Offline

    Mitsugaru

    Think I can safely assume the method resides in the same class. Are you sure that its the mySQL var that is null and not one of the other method calls that you have chained there that is returning null?
     
    KingNyuels likes this.
  3. Offline

    KingNyuels

    Mitsugaru
    'mySQL' is null. Tested with debug outputs, changing the line in which the variable is, et cetera.

    King
     
  4. Offline

    KingNyuels

    *Bump*​
     
  5. Offline

    Alshain01

    What is "MySQL" data type? What is that coming from?
     
    KingNyuels likes this.
  6. Offline

    KingNyuels

    Alshain01
    I found the error. But thank you anyway.
     
Thread Status:
Not open for further replies.

Share This Page