Tuesday, May 12, 2020

write a java program to store data emp table

import java.sql.*;  
class MysqlCon1{  
public static void main(String args[]){  
try{  
Class.forName("com.mysql.jdbc.Driver");  
Connection con=DriverManager.getConnection(  
"jdbc:mysql://localhost:3306/cse1","root","");  
Statement stmt=con.createStatement();  
int result=stmt.executeUpdate("insert into emp values(122,'raghu')");  
System.out.println(result+" records affected");   
con.close();  
}catch(Exception e){ System.out.println(e);}  
}  

No comments:

Post a Comment