ACCESSING DATABASES WITH JDBC
#1

ACCESSING DATABASES WITH JDBC

[attachment=17406]
Using JDBC in General
In this section we present the seven standard steps for querying databases. In Section
17.2 we give two simple examples (a command-line program and a servlet) illustrating
these steps to query a Microsoft Access database.
Following is a summary; details are given in the rest of the section.
1. Load the JDBC driver. To load a driver, you specify the classname
of the database driver in the Class.forName method. By doing so,
you automatically create a driver instance and register it with the
JDBC driver manager.
2. Define the connection URL. In JDBC, a connection URL specifies
the server host, port, and database name with which to establish a
connection.
3. Establish the connection. With the connection URL, username,
and password, a network connection to the database can be established.
Once the connection is established, database queries can be
performed until the connection is closed.
4. Create a Statement object. Creating a Statement object enables
you to send queries and commands to the database.
5. Execute a query or update. Given a Statement object, you can
send SQL statements to the database by using the execute,
executeQuery, executeUpdate, or executeBatch methods.
6. Process the results. When a database query is executed, a
ResultSet is returned. The ResultSet represents a set of rows
and columns that you can process by calls to next and various
getXxx methods.
7. Close the connection. When you are finished performing queries
and processing results, you should close the connection, releasing
resources to the database.

Load the JDBC Driver
The driver is the piece of software that knows how to talk to the actual database
server. To load the driver, you just load the appropriate class; a static block in the
driver class itself automatically makes a driver instance and registers it with the
JDBC driver manager. To make your code as flexible as possible, avoid hard-coding
the reference to the classname. In Section 17.3 (Simplifying Database Access with
JDBC Utilities) we present a utility class to load drivers from a Properties file so
that the classname is not hard-coded in the program.
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: source code for library management system in jdbc, use mobile phones and biometrics for accessing restricted web services, 1 on the use of mobile phones and biometrics for accessing restricted web services, jdbc code for project on online shopping, mini project abstracts for cse using jdbc, database jdbc, modules for on the use of mobile phones and biometrics for accessing restricted web services,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  Privacy-Preserving Updates to Anonymous and Confidential Databases - JAVA project uploader 3 2,184 23-12-2012, 07:35 PM
Last Post: mr.patil1234
  On the Use of Mobile Phones and Biometrics for Accessing Restricted Web Services project uploader 1 2,392 05-11-2012, 11:46 AM
Last Post: Guest

Forum Jump: