ここに私のコードがあります
key = KeyGenerator.getInstance(algorithm).generateKey();
byte[] keyBytes = key.getEncoded();
String k = new String(keyBytes);
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");
Statement st = con.createStatement();
rs = st.executeQuery("select tid from tid");
while(rs.next())
{
mid = Integer.parseInt(rs.getString(1));
b = Integer.toString(mid);
++mid;
a = Integer.toString(mid);
}
out.println(k);
ps = con.prepareStatement("insert into key values (?,?)");
ps.setString(1,a);
ps.setString(2,k);
ps.executeUpdate();
そして、エラーは
javax.servlet.ServletException: com.mysql.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 'key values ('8','›ÄX%ß=dÜgž=ŒT8ï8L]4C®°')' at line 1