For developing along with a JDBC, we must setup a environment of JDBC for example we are operating on windows platform.
Install J2SE 5.0 (JDK 5.0) from official website of java
We should the following environment variables to set as below
e.g. C:\Program Files\Java\jdk1.5.0_20\jre\lib.
e.g. C:\Program Files\Java\jre1.5.0_20\bin.
For a course running a database with a table is a query and solve.
Install a database which is better for you
CLASSPATH: variable to C:\Program Files\MySQL\mysql-connector-java- 5.1.8\mysql-connector-java-5.1.8-bin.jar.
The JDK involves a JDBC-ODBC Bridge driver which makes a Open Database Connectivity (ODBC) drivers accessible to programmers using a JDBC API.
There are 5 steps involved to connect java application with data base using a JDBC
The forName( ) method is used to register a driver class this technique is utilized to powerfully stack the driver class.
Syntax of forNAME( ) Method :
Public void static forName(String className)
The getConnection( )strategy for Driver Manager class is utilized to build up association with the database.
public static Connection getConnection(String url)throws SQLException
public static Connection getConnection(String url,String name,String password)
The createStatement() technique for Connection interface is utilized to make explanation, the question of proclamation is mindful to execute inquiries with the database.
Syntax of createStatement() method:
public Statement createStatement()throws SQLException
The executeQuery() technique for Statement interface is utilized to execute questions to the database. This strategy restores the protest of ResultSet that can be utilized to get every one of the records of a table .
public ResultSet executeQuery(String sql)throws SQLException
The executeQuery() technique for Statement interface is utilized to execute questions to the database. This technique restores the protest of ResultSet that can be utilized to get every one of the records of a table.
Syntax of close() method:
public void close()throws SQLException
Types of JDBC Driver
JDBC Driver is a software module which enables java application to relate with the database. There are 4 types of JDBC drivers.
1. Bridge driver of JDBC-ODBC
2. Driver Native-API
3. Driver Network Protocol
4. Thin driver
The JDBC-ODBC connect driver utilizes ODBC driver to associate with the database. The JDBC-ODBC connects driver changes over JDBC technique calls into the ODBC work calls. This is presently demoralized in light of thin driver.
2) Native-API driver
The Native API driver utilizes the customer side libraries of the database. The driver changes over JDBC technique calls into local calls of the database API. It is not composed completely in java.
Execution updated than JDBC-ODBC connect driver.
3) Network Protocol driver
The Network Protocol driver utilizes middle ware (application server) that proselytes JDBC calls straightforwardly or by implication into the merchant particular database convention. It is completely composed in java.
No customer side library is required in light of use server that can perform many errands like reviewing, stack adjusting, logging and so on.
4) Thin driver
The thin driver changes over JDBC calls straightforwardly into the merchant particular database convention. That is the reason it is known as thin driver. It is completely composed in Java dialect.
The DriverManager example of true excellence as an interface among client and drivers. It monitors the drivers that are accessible and handles setting up an association between a database and the proper driver. The DriverManager class keeps up a rundown of Driver classes that have enlisted themselves by calling the strategy DriverManager.
A Connection is the session between java application and database. The Connection interface is a processing plant of Statement, Prepared Statement, and DatabaseMetaData i.e. protest of Connection can be utilized to get question of Statement and DatabaseMetaData.
The Connection interface give numerous strategies to exchange administration like submit() rollback().
Methods of Connection Interface:
to our newsletter
Azure is a great Microsoft Cloud Computing platform in providing various cloud services through online. ITGuru Certified Azure Architect certification course gives you the practical knowledge on Azure Cloud platform through real-world use cases from live experts
Getting knowledge of cloud platforms like ServiceNow is essential in today’s world for the smooth running of projects in cloud platform. Turn your dream to the reality of becoming the Certified ServiceNow Administrator through ServiceNow Administration online certification Course with practical examples by live industry experts through online at ITGuru with real-world use cases.
knowing the basics on any platform like Workday is not enough to sustain the IT industry. Hence it is essential to go beyond on Workday basics like Workday Financials training which lets you know the application of Financials management in real -world use cases from ITGuru Live Experts in a practical way.
An organization is considered as the best one when it offers the best benefits to the employee. Moreover, the greater the employee benefits, the greater the contribution to the organization. ITGuru let you know the practical workday Human Resource Management(HRM) features with live examples by experts
Turn your dream into reality by ITGuru live experts with real-world use cases through practical knowledge on python online course and become the certified associate in python programming and become a master in python programming
Python is the trending programming language in the IT industry. Mastering in python programming gives you more value among the people in the IT industry. Hence start today to learn python programming online by live experts with real-time uses cases at ITGuru