Advertisement
Guest User

Untitled

a guest
Apr 18th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package sandbox;
  7.  
  8. import java.sql.Connection;
  9. import java.sql.DriverManager;
  10. import java.sql.SQLException;
  11. import java.sql.Statement;
  12.  
  13. /**
  14. *
  15. * @author Jesper
  16. */
  17. public class Sandbox {
  18.  
  19. /**
  20. * @param args the command line arguments
  21. */
  22. public static void main(String[] args) throws ClassNotFoundException, SQLException{
  23. Connection con = connectionSetup();
  24. Statement stmt = con.createStatement();
  25. String test = "INSERT INTO execution_times VALUES (null, 55)";
  26. stmt.executeUpdate(test);
  27. }
  28.  
  29. public static Connection connectionSetup() throws ClassNotFoundException, SQLException{
  30. Class.forName("com.mysql.jdbc.Driver");
  31. Connection con = DriverManager.getConnection("jdbc:mysql:///KOD", "root", "sudo");
  32. con.setAutoCommit(false);
  33. return con;
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement