0% found this document useful (0 votes)
25 views

JDBC Concepts: Statement Object

JDBC is a Java API that controls basic functions for Java application development to interact with databases. It provides SQL capabilities similar to ODBC and dynamic SQL. A typical JDBC application involves creating a Connection object, generating a Statement object using the Connection, passing a SQL statement to the Statement to return a ResultSet, looping through any rows in the ResultSet to retrieve column values. The difference between client- and server-side JDBC is that client-side uses a JDBC driver to connect to the database server, while server-side JDBC calls DriverManager.getConnection() directly on the server.

Uploaded by

querysiva6410
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

JDBC Concepts: Statement Object

JDBC is a Java API that controls basic functions for Java application development to interact with databases. It provides SQL capabilities similar to ODBC and dynamic SQL. A typical JDBC application involves creating a Connection object, generating a Statement object using the Connection, passing a SQL statement to the Statement to return a ResultSet, looping through any rows in the ResultSet to retrieve column values. The difference between client- and server-side JDBC is that client-side uses a JDBC driver to connect to the database server, while server-side JDBC calls DriverManager.getConnection() directly on the server.

Uploaded by

querysiva6410
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

JDBC

JDBC concepts
JDBC is a Java API and a standard part of the Java class libraries that control basic functions for Java application development. The SQL capabilities that JDBC provides are similar to those of ODBC and dynamic SQL. The following sequence of events is typical of a JDBC application: 1 Create a Connection object call the getConnection( ) static method of the
DriverManager class to create a Connection object. This establishes a

database connection. 2 Generate a Statement object use the Connection object to generate a Statement object. 3 Pass a SQL statement to the Statement object if the statement is a query, this action returns a ResultSet object. The ResultSet object contains the data returned from the SQL statement, but provides it one row at a time (similar to the way a cursor works). 4 Loop over the rows of the results set call the next( ) method of the ResultSet object to: Advance the current row (the row in the result set that is being exposed through the ResultSet object) by one row. Return a Boolean value (true/false) to indicate whether there is a row to advance to. 5 For each row, retrieve the values for columns in the ResultSet object use the getInt( ), getString( ), or similar method to identify either the name or position of the column.

Differences between client- and server-side JDBC


The difference between JDBC on the client and in the database server is in how a connection is established with the database environment. When you use client-side or server-side JDBC, you call the
Drivermanager.getConnection() method to establish a connection to the server.

For client-side JDBC, you use the Sybase jConnect JDBC driver, and call the Drivermanager.getConnection() method with the identification of the server. This establishes a connection to the designated server.

You might also like