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

How to Retrieve Excel data into mysql using type 2 JDBC-ODBC driver

Ads

 
 

Share on Google+Share on Google+

Vijay Kumar
How to Retrieve Excel data into mysql using type 2 JDBC-ODBC driver
2 Answer(s)      5 years and 10 months ago
Posted in : JDBC

Can any please help it is very urgent.

I tried to read excel sheet using ODBC type 1 driver and i have done successfully.but disadvantage is when i create a executabloe jar for this .it is working in my system only .since the odbc coneecction is their in my system only.if i want to work in my colleagues system i need to connect same DNS name in my colleague system also .So, this is the problem. so, can any one help me without creating DNS we should retrieve data from excel using ODBC.plz help me guys..........

Ads
View Answers

October 17, 2011 at 11:34 AM


Follow these steps:

Open Data Sources (Start->Settings->Control Panel->Administrative Tool->Data Sources(ODBC)
Open User DSN tab
Add a user DSN
Select Microsoft Excel Driver(*.xls)
Select work book or excel file and Create the DSN name (e.g excel)
Click "Ok" and restart your compiler.
Compile the following java code:

import java.sql.*;

public class JDBCExcel { 
    public static void main(String args[]) { 
        try{ 
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            Connection conn = DriverManager.getConnection("jdbc:odbc:excel","", ""); 
            Statement st = conn.createStatement(); String query = "select * from [Excel sheet$]";
            ResultSet rs = st.executeQuery(query); 
            while(rs.next()){
                System.out.println(rs.getString(1)+" "+rs.getString(2)+" "+rs.getString(3));
                } 
                }
        catch(Exception e){}
        }
    }

Note: 'Excel sheet' is the sheet name of the selected excel file in the query.



October 17, 2011 at 2:20 PM


Sir,

Actually i too know how to read data using type 1 driver.sir,you have given procedure to do is done right but u have used type 1 driver but i want to do this using type 2 or type 4 driver (i.e nothing but not to create DNS in local system) the program should automatically do DNS creation and them access excel data and should given output of reading data in console.

thnx for write some answer that u know...


Ads









Related Tutorials/Questions & Answers:
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  Can any please help it is very urgent. I tried to read excel sheet using ODBC.... so, can any one help me without creating DNS we should retrieve data from excel
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 ODBC driver?   Fetching results JDBC ODBC Driver A. The default fetch
Advertisements
How to Retrieve Data from the database and write into excel file using Java
How to Retrieve Data from the database and write into excel file using Java  Hi, I am trying to develop an small application where i trying to retrieve Data from the database and store the details in excel file. Please can
Connection using Jdbc-odbc bridge Driver
Connection using JDBC-ODBC bridge driver JDBCExample.java... database is ready to connect using JDBC-ODBC bridge driver. For this you have...;); --In this program "forName()" function is used to load the JDBC-ODBC bridge driver
Read Excel data using JSP and update MySQL databse
Read Excel data using JSP and update MySQL databse  HOw to read excel data using JSP and update MySQl database
How to Retrieve Data from Facebook Using PHP
How to Retrieve Data from Facebook Using PHP  is this link has right content regards that?? http://techpdf.co.cc/blog/how-to-retrieve-data-from-facebook-using-php
How to Retrieve Data from Facebook Using PHP
How to Retrieve Data from Facebook Using PHP  is this link has right content regards that?? http://techpdf.co.cc/blog/how-to-retrieve-data-from-facebook-using-php
jdbc,odbc,MySQL,swing - Java Beginners
jdbc,odbc,MySQL,swing  write a code that displays a menu list of all available database drivers in a window,and allows the user to select any driver... to the selected database driver.It is very well known as jdbc front end of a database
HOW TO SAVE XML INTO MYSQL AND RETRIEVE IT USING JAVA
HOW TO SAVE XML INTO MYSQL AND RETRIEVE IT USING JAVA  H ello, i have an xml code, i need to save it into mysql 5.5 server database using java. i also want to be able to retrieve it as well. please note that i want it saved
how to insert and retrieve an image from mysql using java - Java Beginners
how to insert and retrieve an image from mysql using java  how to insert and retrieve an image from mysql using java?  Hi friend, Code.... */ String connectionURL = "jdbc:mysql://localhost:3306/mahendra
unable to retrive the data from mysql using servlet using jdbc driver
unable to retrive the data from mysql using servlet using jdbc driver ... Connection con = null; String url = "jdbc:mysql://localhost:3306/"; String dbName = "rapax"; String driver = "com.mysql.jdbc.Driver"; String
How to export data from jsp to excel sheet by using java
How to export data from jsp to excel sheet by using java   How to export data from jsp to excel sheet by using java
How to export data from html to excel sheet by using java
How to export data from html to excel sheet by using java   How to export data from html to excel sheet by using java
retrieve related data from database using jsp and mysql
retrieve related data from database using jsp and mysql  Hi sir, please give some example of jsp code for retrieving mysql database values in multiple dropdown list. if we change a value in a dropdown its related value must
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
how to retrieve data from database
how to retrieve data from database  unable to retrieve data from database using mySQL by using jsp sessions and beans for editing
How to export data from html file to excel sheet by using java
How to export data from html file to excel sheet by using java    How to export data from html file to excel sheet by using java
how read excel data into database using struts2 with hibernate
how read excel data into database using struts2 with hibernate   hi friends, i am venkat i am started learning struts 2, please help me how to read excel data into database using struts2 with hibernate, please show me
Retrieve The Data From MySql Datbase
Retrieve The Data From MySql Datbase   How to Retrieve The Data From MYSQL database TO Use Select the Emp_id Option.And Also Search Option
How to export data from html file to excel sheet by using java
How to export data from html file to excel sheet by using java   reading the data from Html file
How to retrieve data by using combo box value in jsp? - JSP-Servlet
How to retrieve data by using combo box value in jsp?  I am using a single jsp form.. i did not get from another form.. i do not use 2 jsp form.. all.... Note: I am using only this jsp form.. i do not use
how to retrieve image from mysql using java - Java Beginners
how to retrieve image from mysql using java  hi i am using jsf and java IDE netbean,database mysql.how to retrieve image from mysql database. please help me   Hi friend, I am sending you a link. I hope
XLS JDBC Example
driver therefore you should use JDBC - ODBC bridge driver to connect your excel... name. Now Create a Data Source Name using Microsoft  Excel Driver. Give... .style1 { background-color: #FFFFCC; } XLS JDBC XlS JDBC driver
Retrieve Data from the database and write into excel file
Retrieve Data from the database and write into excel file. In this section, we are going to retrieve data from the database and write into the excel file... connection = DriverManager.getConnection( "jdbc:mysql://localhost:3306/test
How to save excel sheet into mysql database using blob or clob
How to save excel sheet into mysql database using blob or clob  Hi All, I am new to java and i need to upload excel sheet to mysql, please suggest... know to go further, which one should i use BLOB or CLOB ? I have tried using
how to retrieve data from multiple tables in jsp using javabeans
how to retrieve data from multiple tables in jsp using javabeans   ...("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql... = DriverManager.getConnection("jdbc:mysql://localhost:3306/ips?user=root&password
how to retrieve data from multiple tables in jsp using javabeans
how to retrieve data from multiple tables in jsp using javabeans   ...("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql... = DriverManager.getConnection("jdbc:mysql://localhost:3306/ips?user=root&password
how to retrieve data from multiple tables in jsp using javabeans
how to retrieve data from multiple tables in jsp using javabeans   ...("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql... = DriverManager.getConnection("jdbc:mysql://localhost:3306/ips?user=root&password
How to retrieve data by using combo box value in jsp? - JSP-Servlet
How to retrieve data by using combo box value in jsp?  For example, In Employee.jsp form, When i click employee id value in combo box ,the related employee name will be displayed in text field
Data retrieve from mysql database
Data retrieve from mysql database  Hi sir, please give some example...("name").toString(); String data=""; Connection conn = null; String url = "jdbc:mysql://localhost:3306/"; String dbName = "test"; String driver
Identify Excel's cell data type
Identify Excel's cell data type In this section, you will learn how you can identify cell's data type and handle it appropriately using Apache POI. In Apache POI library, for fetching each type of data, there is separate