Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- class insertJDBC
- {
- public static void main(String args[])throws Exception
- {
- Class.forName("com.mysql.jdbc.Driver");
- Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/VCE","root","eswecha");
- Statement st=con.createStatement();
- int result=st.executeUpdate("insert into emp values(101,'ravi')");
- if(result>0)
- System.out.println("inserted");
- else
- System.out.println("not inserted");
- con.close();
- st.close();
- }
- }
Add Comment
Please, Sign In to add comment