Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

JDBC Get Int

In this tutorial we want to describe you a code that help in understanding JDBC Get Int.


JDBC Video Tutorial: Create, Read, Update and Delete (CRUD) Operation examples JDBC Video tutorial - How to read Data from MySQL Database? JDBC Video tutorial - How to delete Data in a MySQL Database? Solving java.lang.ClassNotFoundException: com.mysql.jdbc.Driver exception JDBC Video tutorial - How to update Data in a MySQL Database? JDBC Video Tutorial- How to insert data into MySQL database table? JDBC Video Tutorial: How to download JDBC Driver for MySQL? JDBC Tutorial - Writing first JDBC example and running in Eclipse Java Cross Join MySQL Database Connectivity Example In Java Change Column Name in MySQL Java Mysql Connection Example JDBC ODBC Connection In Java ResultSet In Java Prepared Statement Example JdbcRowSet interface Java JdbcRowSet Example First Step towards JDBC! JDBC Training, Learn JDBC yourself Jdbc Get Column Names JDBC Example with MySQL JDBC Prepared Statement Update JDBC Prepared Statement Insert JDBC Prepared Statement Example JDBC Prepared statement Close JDBC Prepared Statement Addbatch JDBC Nested Resultset JDBC-Odbc Connection JDBC-Odbc Connectivity JDBC Insert Preparedstatement JDBC Insert Null JDBC Get Metadata JDBC Insert Record Jdbc Insert Statement JDBC Meta Data Get tables Jdbc Mysql Connection String Jdbc Mysql Connection Url JDBC Next Jdbc Get Connection JDBC Get Int JDBC Exception JDBC Get Row Count JDBC Functions JDBC Fetch JDBC Execute Update Example JDBC Execute Statement JDBC Execute Query JDBC Drive For Mysql JDBC Connectivity Code In Java JDBC connection timeout

JDBC Get Int


The  get Byte, get Short, get Long, get Float, get Double, getBigDecimal, get Boolean, get String, get Object is readable by Get Int in Java.

Understand with Example

The Tutorial illustrates an example from JDBC Get Int.In this Tutorial, the program explain you a JDBC code that connect the front end application to the backend database. The code include the sql queries that return you the integer and retrieve the element from the database. For this we have a class Jdbc Get Int, Inside the main method driver loading is done by calling a class.forname(  ) ,that accept driver class as argument.





  Method    Description


Return you an object of connection, built  a connection between url and database.

con.createStatement( )

Return you a sql object, The return object is used to send and execute the query in database.

executeQuery( )

Return you a result set, This result set contain a set of retrieved element from a table

getInt( )

Return you the retrieve the value of specified column in the current row of the result set object as int.

The ) return you the next element in the series. Finally the println print the respective id on the output. The con.close ( ) closed connection with database. 

Finally the println print the respective id in the output. In case an exception occurred in try block, the subsequent catch block check and caught the exception.

import java.sql.*;

public class JdbcGetInt {

    public static void main(String args[]) {

        Connection con = null;
        Statement st = null;
        ResultSet rs = null;

        String url = "jdbc:mysql://localhost:3306/";
        String db = "komal";
        String driver = "com.mysql.jdbc.Driver";
        String user = "root";
        String pass = "root";

        try {
            con = DriverManager.getConnection(url + db, user, pass);
            st = con.createStatement();

            String sql = "select * from person";
            rs = st.executeQuery(sql);
            while ( {

        } catch (Exception e) {


Id	Name
1	Girish
2	komal

Download code


Share on Google+Share on Google+

JDBC Get Int

Posted on: November 17, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: JDBC Get Int   View All Comments

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image