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