Solved NPE with SQL?

Discussion in 'Plugin Development' started by Areoace, Jan 22, 2016.

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

    Areoace

    I'm completely new to using SQL methods, so why is it that when I get an instance of another class and use it I get an NPE? Will post code if needed :)
     
  2. Offline

    tommyhoogstra

    potato put your code
     
  3. Offline

    Areoace

    Code:
        public void connect()
        {
            try
            {
    
                Class.forName("com.mysql.jdbc.Driver");
                conn = (Connection) DriverManager.getConnection(DB, USER, PASS);
    
            }        
            catch(Exception ex)
            {
        ex.printStackTrace();
            }
        }
    
    I see, so I had to make it a connection instead of using void, wups... Gosh that was silly of me, I should have thought of that. Sorry for wasting anyones time.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jan 22, 2016
  4. Offline

    mythbusterma

    @Areoace

    So is there still an issue?
     
  5. Offline

    Areoace

    @mythbusterma nah, I'm still trying to get the jist of it but other than that theres nothing. How do I mark as solved?
     
  6. Offline

    Zombie_Striker

    @Areoace
    Thread tools > edit title > Click on "prefix" > select "[solved]"
     
    Areoace likes this.
Thread Status:
Not open for further replies.

Share This Page