jdbc example insert data database
import java.sql.*;
class InsertData
{
public static void main(String[] args)throws Exception
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:xe","system","chandru");
System.out.println(" Connected 2 DB.....");
Statement stmt=con.createStatement();
String vsql="insert into emp2 values(12,'chandu',100)";
stmt.executeUpdate(vsql);
System.out.println("Table has been created.....");
}
}
0 comments:
Post a Comment