Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import java.sql.*;
  2.  
  3. public class Database {
  4.  
  5. public Database(){ // constructor
  6.  
  7. try {
  8. Class.forName ("com.mysql.jdbc.Driver").newInstance();
  9. Connection connection = DriverManager.getConnection ("jdbc:mysql://localhost:3306/dbswcorp", "root", "");
  10.  
  11. Statement stmt = connection.createStatement();
  12.  
  13. String vSQL;
  14. vSQL = "Insert Into usermaster Values('a','b','1','c','d') ";
  15.  
  16. stmt.execute(vSQL);
  17. stmt.close();
  18. connection.close();
  19.  
  20. }catch(Exception e){
  21.  
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement