Guest User

Untitled

a guest
Mar 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. Random rand = new Random();
  2. int r = rand.nextInt(200);
  3. Connection co2 = null;
  4. PreparedStatement ps2 = null;
  5. ResultSet rs2 = null;
  6. try {
  7. Class.forName("com.mysql.jdbc.Driver");
  8. co2 = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "");
  9. ps2 = co2.prepareStatement("insert into class" + " values (?, ?, ?, ?)");
  10. ps2.setInt(1, r);
  11. ps2.setString(2, rs.getString("superClass"));
  12. ps2.setString(3, "Object");
  13. ps2.setString(4, null);
  14. ps2.execute();
  15. System.out.println("insert passé");
  16. list.add(rs.getString("superClass"));
  17. } finally {
  18. close(co2, ps2, rs2);
  19. }
  20.  
  21. Random rand = new Random();
  22. int r = rand.nextInt(200);
  23. Connection co2 = null;
  24. PreparedStatement ps2 = null;
  25. ResultSet rs2 = null;
  26. try {
  27. Class.forName("com.mysql.jdbc.Driver");
  28. co2 = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "");
  29. ps2 = co2.prepareStatement("insert into class" + " values (?, ?, ?, ?)" + "insert into typeclass" + " values (?, ?, ?, ?)");
  30. ps2.setInt(1, r);
  31. ps2.setString(2, rs.getString("superClass"));
  32. ps2.setString(3, "Object");
  33. ps2.setString(4, null);
  34. ps2.setInt(5, r);
  35. ps2.setString(6, rs.getString("superClass"));
  36. ps2.setString(7, "Object");
  37. ps2.setString(8, null);
  38. ps2.execute();
  39. System.out.println("insert passé");
  40. list.add(rs.getString("superClass"));
  41. } finally {
  42. close(co2, ps2, rs2);
  43. }
  44.  
  45. MySQLSyntaxErrorException near "insert into typeclass values (174, "JFrame", "Object", null)"
Add Comment
Please, Sign In to add comment