No Database selected when retrieving from mysql website

后端 未结 3 2028
半阙折子戏
半阙折子戏 2020-11-28 16:29

I have a mysql database that I am trying to retrieve from our website host (godaddy). I followed a format that seems to be right but it tells me that:

java.         


        
3条回答
  •  误落风尘
    2020-11-28 16:29

    I had the same problem.

    Just run one more query (before your 'SELECT' statement) to connect to your database.

    First:

    sql = "USE ";
    
    ResultSet rs = stmt.executeQuery(sql); 
    

    And after:

    sql = "SELECT * FROM item_master";
    
    rs = stmt.executeQuery(sql);
    

提交回复
热议问题