import java.sql.*;class Type1{ public static void main(String[] args)throws Exception { Connection c=null; try { Driver d=new Driver("sun.jdbc.odbc.JdbcOdbc"); //or Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); c=DriverManager.getConnection("jdbc:odbc:emp1","scott","tiger"); Statement s=c.createStatement(); s.executeUpdate("insert into dept(deptno,loc)values(60,'hyd')"); } catch(Exception e) { e.printStackTrace(); } finally { c.close(); } }}
JDBC is a API its communicate with relational Databases.
Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.
Copyright ©2003-2010 CoolInterview.com, All Rights Reserved. Privacy Policy | Terms and Conditions Page URL: http://www.coolinterview.com/interview/5008/default.asp?cachecommand=bypass