source file name: JdbcInsert.java
import java.sql.*;
class JdbcInsert
{
public static void main(String as[])
{
System.out.println("JDBC Program");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:javadsn");
Statement st=con.createStatement();
String s1 = "insert into result values(233,'fycs',47,54)";
String s2 = "insert into result values(213,'fycs',56,63)";
String s3 = "insert into result values(240,'fycs',73,64)";
st.executeUpdate(s1);
st.executeUpdate(s2);
st.executeUpdate(s3);
con.close();
st.close();
}
catch(Exception e)
{
System.out.println(e );
}
}
}
output:
0 Comments
Post a Comment