




























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























©NIIT
In this lesson, you will learn about:
©NIIT JDBC and JavaBeans
©NIIT
©NIIT Other way… Java Programs JDBC API MySQL JDBC Driver JDBC-ODBC Bridge Driver
Microsoft ODBC Driver Oracle JDBC Driver
©NIIT
©NIIT
©NIIT
©NIIT
©NIIT
i. Programmatically (two options):
©NIIT
©NIIT
©NIIT
- Creating and Executing JDBC Statements - (^) The Connection object provides the createStatement() method to create a Statement object. - (^) You can use static SQL statements to send requests to a database to retrieve results. - (^) The Statement interface contains the following methods to send static SQL statements to a database: - (^) ResultSet executeQuery(String str) - (^) int executeUpdate(String str) - (^) boolean execute(String str) (^) E.g. If a Connection object is like a cable linking your program to a database, then an object of Statement or its subclass can be viewed as a cart that delivers SQL statements for execution by the database and brings the result back to the program. (^) Once Connection object is created, you can create statements for executing SQL statements E.g. Statement stmt=con.createStatement();
©NIIT Creating & Executing Statements(Contd.) 1)Querying a Table
©NIIT 2) Inserting Rows in a Table