Q) Develop a JDBC application that creates one account in the database. Make use of JDBC-ODBC approach.
A)
import java.sql.*;
class Accountopening {
public static void main(String[] args)throws Exception {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("Jdbc:Odbc:mydns","scott","tiger");
Statement st = con.createStatement();
int re = st.executeUpdate("INSERT INTO ACCOUNT VALUES(1001,'HARI',10000)");
System.out.println(re+"record is inserted succesfully");
st.close();
con.close();
}
}
Comments
Post a Comment