20-07-2012, 03:39 PM
JDBC
JDBC .ppt (Size: 176.5 KB / Downloads: 29)
Introduction
JDBC is a Java-based data access technology (Java Standard Edition platform) from Sun Microsystems.
This technology is an API for the Java programming language that defines how a client may access a database.
It provides methods for querying and updating data in a database.
Using JDBC you can send SQL, PL/SQL statements to almost any relational database.
JDBC is a Java API for executing SQL statements and supports basic SQL functionality.
JDBC Architecture
Java application calls the JDBC library. JDBC loads a driver which talks to the database. We can change database engines without changing database code.
JDBC Driver
JDBC drivers are client-side adapters (installed on the client machine, not on the server) that convert requests from Java programs to a protocol that the DBMS can understand.
The JDBC API uses a Driver Manager and database-specific drivers to provide transparent connectivity to hetrogenous database.
The JDBC driver manager ensures that the correct driver used to access each data source.
Creating a oracle jdbc Connection
getConnection() method is used to establish a connection to a database. It uses a username, password, and a jdbc url to establish a connection to the database and returns a connection object.
try{ Connection dbConnection=DriverManager.getConnection(url,”loginName”,”Password”)}catch( SQLException x ){ System.out.println( “Couldn’t get connection!” );}