0
처음으로 JDBC를 사용하고 있습니다.java 응용 프로그램에서 SQL 쿼리가 실행되지 않습니다.
//STEP 4: Execute a query
System.out.println("Creating statement...");
String sql;
sql = "SELECT * FROM user where username=? and password=?";
stmt = conn.prepareStatement(sql);
//Bind values into the parameters.
stmt.setString(1, value1); // This would set username
stmt.setString(2, value2); // This would set password
ResultSet rs = stmt.executeQuery(sql);
내가 넷빈즈에서 다음과 같은 오류 받고 있어요 :이 날 오류주고있다 코드입니다
"
jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? and password=?
' at line 1"
가이 후 긴 목록입니다하지만이 생각하는 것은 인 내가 문제를 일으키고있어. 내가 도대체 뭘 잘못하고있는 겁니까?