Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC how to set fetch size for jdbc odbc driver
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Java Coder
how to set fetch size for jdbc odbc driver
1 Answer(s)      2 years and 5 months ago
Posted in : JDBC


What is the default fetch size for the JDBC ODBC driver and how can i fetch a set of results for JDBC ODBC driver?


Advertisement
View Answers

May 10, 2012 at 12:02 PM


Fetching results JDBC ODBC Driver

A. The default fetch size of JDBC drivers is 10. In general default fetch size of JDBC drivers is 10. To fetch small number of rows from database, JDBC driver is designed so that it may handle out of memory issues. When you set fetch size 100 , the number of network trips to database will become 10. Now you can see, the performance of your application is improved. So, If you want to retrieve large amount of data from table then set fetch size.

JDBC ODBC Fetch Example

package roseindia.net;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class JDBCsetFetchSize {
        public static void main(String[] args) throws SQLException {
                Connection con = null
                Statement stmt = null; 
                ResultSet rs = null;

                String conUrl = "jdbc:mysql://localhost:3306/";
                String driverName = "com.mysql.jdbc.Driver";
                String databaseName = "student";
                String usrName = "root";
                String usrPass = "root";
                try {
                        // Loading Driver
                        Class.forName(driverName). newInstance();
                } catch (ClassNotFoundException e) {
                        System.out.println(e.toString());
                }
                try {
                        // Getting Connection
                        con = DriverManager.getConnection(conUrl + databaseName, usrName,
                                        usrPass);
                        stmt = con.createStatement();
                         stmt.setFetchSize(100);

                        String query = "SELECT * FROM  student'";

                       rs= stmt.executeUpdate(query);
                   if (rs.next()) {
                System.out.println(rs.getString(1));
            }

                } catch (Exception e) {
                        System.out.println(e.toString());
                } finally {
                        // Closing Connection
                        con.close();
                        stmt.close();
                }
        }
}


Related Tutorials/Questions & Answers:
how to set fetch size for jdbc odbc driver
how to set fetch size for jdbc odbc driver  What is the default fetch size for the JDBC ODBC driver and how can i fetch a set of results for JDBC... table then set fetch size. JDBC ODBC Fetch Example package roseindia.net
Set properties for a JDBC driver
Set properties for a JDBC driver  How do I set properties for a JDBC driver and where are the properties stored
Advertisements
How to Retrieve Excel data into mysql using type 2 JDBC-ODBC driver
How to Retrieve Excel data into mysql using type 2 JDBC-ODBC driver  ... Sources(ODBC) Open User DSN tab Add a user DSN Select Microsoft Excel Driver..."); Connection conn = DriverManager.getConnection("jdbc:odbc:excel
Connection using Jdbc-odbc bridge Driver
Connection using JDBC-ODBC bridge driver JDBCExample.java...;); --In this program "forName()" function is used to load the JDBC-ODBC bridge driver... the connection open by con object. Steps to connect JDBC-ODBC bridge driver
Sun's JDBC-ODBC driver does not implement the getPrimaryKeys() method for the DatabaseMetaData Objects.
Sun's JDBC-ODBC driver does not implement the getPrimaryKeys() method for the DatabaseMetaData Objects.  Is there a way to find the primary key(s) for an Access Database table? Sun's JDBC-ODBC driver does not implement
JDBC-Odbc Connection
JDBC-ODBC Connection       JDBC-ODBC Connection is a JDBC driver that translates the operation... in explaining JDBC Odbc Connection in Java. The code explains you a how creation
how to set folder size in php
how to set folder size in php  hi , i know how to create folder but i dont know how to set size for folder did u know means tell me. thankyour
how to set size of button,textfield.
how to set size of button,textfield.  how we set size of button... large how to set as a preferd size in the panel or frame .when we click maximize button not effect on text or button to their of size the set on the prefered
jdbc odbc
jdbc odbc  i want to fetch the data from the ms access and print... connectivity.. the whole set up is perform only printing part is remaining? so help me how can i perform operation thanks in advanced
jdbc odbc
jdbc odbc  i want to fetch the data from the ms access and print... connectivity.. the whole set up is perform only printing part is remaining? so help me how can i perform operation thanks in advanced
jdbc odbc
jdbc odbc   i have two tables in database 1table's attribute is foreign key of another in this case how to retrive value from both table and show in a gridview combine using java code   Sql query to retrieve values
jdbc odbc
= DriverManager.getConnection("jdbc:odbc:swing"); String sql = "INSERT...jdbc odbc  Sir, i want to get the selected value from JCombobox to ms...("JDBC All in One"); JComboBox petList = new JComboBox(petStrings
jdbc driver
jdbc driver  hello, can we create a own jdbc driver? how can we create
What is ODBC - JDBC
What is ODBC  What is Java ODBC and JDBC?   Method of type.... | JDBC Driver | ODBC Driver
Jdbc Driver - JDBC
JDBC Driver Types  Type of JDBC Driver  four..Type 1(JDBC-ODBC Driver)Type 2(java native driver)Type 3Type 4  Type of JDBC... as: * JDBC-ODBC bridge plus ODBC driver, also called Type 1. * Native-API
The JDBC-ODBC Bridge.
The JDBC-ODBC Bridge.  Are there any ODBC drivers that do not work with the JDBC-ODBC Bridge
no driver - JDBC
the program: run: SQL Exception: No suitable driver found for jdbc:db2... { try { //Loads Type 2 Driver Class.forName...) { System.err.println("Could not load DB2 driver! \n"); System.err.println(e.getMessage
Java JDBC ODBC
Java JDBC ODBC  What is the difference between JDBC and ODBC
Java Jdbc-odbc
Java Jdbc-odbc  What is the difference between JDBC and ODBC
Hibernate Criteria Fetch Size Example
Hibernate Criteria Fetch Size Example  I want example of Hibernate Criteria Fetch Size. Share me the best example program and tutorial of Hibernate Criteria Fetch Size. Thanks   Best Example of Hibernate Criteria Fetch
JDBC Driver - JDBC
JDBC Driver  What are the diffrent types of JDBC driver
How to set UILabel text size, color etc.. in XCode
How to set UILabel text size, color etc.. in XCode  How to set UILabel text size (height), color etc.. in XCode
JDBC Driver
JDBC Driver  I want to know the clear syntax and usages of $ types of JDBC drivers. Where can i get it? I search for it, nobody give Syntax for tat different drivers. can u give a sample codes for tat
jdbc odbc connection
jdbc odbc connection  i need a program in java which uses a jdbc odbc... computer and then access in your Java program. Read the JDBC ODBC example. Thanks   Here is another example with explanation: Example of JDBC ODBC
JDBC-Odbc Connectivity
JDBC-ODBC Connectivity       The code illustrates an example from JDBC-ODBC...;"jdbc:odbc:emp";   public 
JDBC Driver interface
JDBC Driver interface  What is JDBC Driver interface
What is JDBC Driver ?
What is JDBC Driver ?  What is JDBC Driver
MySQL Driver for JDBC - JDBC
MySQL Driver for JDBC  Sir, I have started reading your JDBC tutorial...... Example."); Connection conn = null; String url = "jdbc:mysql://localhost:3306   Hi,Please download the driver from http://www.mysql.com/products/connector
Java JDBC driver
Java JDBC driver  What is JDBC Driver
XLS JDBC Example
driver therefore you should use JDBC - ODBC bridge driver to connect your excel... .style1 { background-color: #FFFFCC; } XLS JDBC XlS JDBC driver is used to access xls file from java application. It is read only JDBC driver
JDBC ODBC Connection In Java
JDBC ODBC Connection In Java In this section we will read about the various aspects of JDBC ODBC such as, JDBC-ODBC bridge, JDBC ODBC connection, how... JDBC ODBC Bridge driver. The DSN (Data Source Name) specifies the connection
 

 

 

DMCA.com