In this Tutorial we want to describe you a code that helps you easy to understand Jdbc Functions. The code include a class Jdbc Functions, Inside the main method, the list of following method steps is to be carried out given below -
List of packages include:
Import java.sql provides you all the list of classes that provides you network interface for communicating between the front end java application and backend database.
Import Java.util contain a collection framework that provides you a legacy class, event model,date,time facilities.
After importing the required packages, we create an object of HashMap.This object store key value pair. The value can be duplicated, but key must be unique.
map. put ( ) : This is used to associate the specified value with the specified keys in this object.
Define a function void Jdbc ( Hash Map map), that accept map object as parameter and retain all the value from map object.
map. get ( ) : The method return you the value to the specified key is mapped in identity hash map, or return null if the map do not contains mapping for specified key.
Loading a driver by calling a class.forname( ),that accept driver class as argument.
DriverManager.getConnection ( ) : This method return you an object of connection. This is used to built a connection between url and database.
con.createStatement ( ) : This return you an sql object, An connection object send and execute the sql query in the backend.
execute query( ) : This is used to retrieve the record set from a table using select statement from the backend table.
On the execution of program, the println print the record set from database using -
rs.getString( ) : This Return you the record set on HTML Page.
Incase there is an exception in try block, the
subsequent catch block caught and handle the exception.
Incase there is an exception in try block, the subsequent catch block caught and handle the exception.
no. Name Dob 1 Girish 1984-06-02 2 komal 1984-10-27
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: JDBC Functions
Post your Comment