JDBC CRUD Statement Operation.

package jdbc_stmt_example;

import java.sql.*;


public class Jdbc_CRUD_Stmt{


public static void main(String[] args) throws Exception{

Class.forName("com.mysql.jdbc.Driver");

System.out.println("Driver Load Success.....");

Connection cn=DriverManager.getConnection("jdbc:mysql://localhost:3306/batch138","root","root");

System.out.println("Connection Success.....");

Statement stmt=cn.createStatement();

stmt.executeUpdate("insert into Student values(101,'Ganesh')");

System.out.println("Inserted......");

stmt.executeUpdate("update student set name='jaa' where id=101");

System.out.println("Updated....");

stmt.executeUpdate("delete from student where id=101");

}


}

Comments

Popular posts from this blog

Primary/Main features of Java

HTTrack ऑफलाइन वेबसाइट डाउनलोडर क्या है ?

Which language is used for Java?