Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- import javax.swing.JOptionPane;
- public class Session {
- public Session(){
- try{
- //CONNECT TO DATABASE
- Connection myConn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/test", "root", "admin");
- //CREATE STATEMENT
- Statement mySmt = myConn.prepareStatement("UPDATE addTest SET id = id + 1");
- //EXECUTE SQL QUERY
- mySmt.executeUpdate("UPDATE addTest SET id = id + 1");
- }catch (Exception exc){
- exc.printStackTrace();
- JOptionPane.showMessageDialog(null, exc.getMessage());
- }
- }
- public static void main(String args[]){
- new Session();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement