Advertisement
Guest User

Untitled

a guest
Jul 30th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. Connection connection = null;
  2.  
  3. String url = "jdbc:mysql://localhost/testdb";
  4. String user = "root";
  5. String password = "";
  6. Class.forName("com.mysql.jdbc.Driver");
  7. connection = DriverManager.getConnection(url,user, password);
  8. Statement stmt = connection.createStatement();
  9.  
  10. // progressBar.setValue(50);
  11. StringTokenizer st = new StringTokenizer(mobid.getText(), ",");
  12. while (st.hasMoreTokens()) {
  13. String idmob = st.nextToken();
  14.  
  15. stmt.execute("INSERT INTO droplist VALUES('" + idmob + "', '" + iditem.getText() + "', '" + min.getText() + "', '" + max.getText() + "', '" + category.getText() + " ', '" + chance.getText() + "0000');");
  16. }
  17.  
  18. if (connection != null)
  19. {
  20. connection.close();
  21. }
  22. if(stmt != null)
  23. {
  24. stmt.close();
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement