mysqlconnector
으로 쿼리를 실행하고 결과를 ResulSet
과 함께 가져 오면 내 첫 번째 코드는 항상 null
입니다.Java에서 문자열 연결은 첫 번째 결과와 함께 null을 나타냅니다.
이 내 코드 :
Class.forName("com.mysql.jdbc.Driver");
conn =DriverManager.getConnection("jdbc:mysql://localhost/","","");
String query = "SELECT Category,Account FROM Settings" ;//
PreparedStatement select = conn.prepareStatement(query);
ResultSet rs = select.executeQuery();
while (rs.next())
{
category += rs.getString("Category")+",";
account += rs.getString("Account")+",";
그리고 내 결과가 항상 :
nullresult, result, result...
심지어는 하나 개의 결과 만은 항상 때 nullResult
내가이 문제를 해결할 수있는 방법?
전체 방법을 제공하고 무엇이라도 말할 수 있습니다! –