Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. public class DataBaseConnection {
  2. private Connection con;
  3. protected Statement st;
  4. protected ResultSet rs;
  5.  
  6. public DataBaseConnection() {
  7. try {
  8. Class.forName("com.mysql.jdbc.Driver");
  9. con = DriverManager.getConnection("jdbc:mysql://localhost/bilete", "root", "");
  10. st = con.createStatement();
  11. st.executeUpdate("INSERT INTO Clienti VALUES('C1','Bejan Isaia','VIP')");
  12. con.close();
  13. } catch (Exception ex) {
  14. System.out.println("Error: " + ex);
  15. }
  16. }
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement