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 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..........

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...









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...; Step5:-Now your database is ready to connect using JDBC-ODBC bridge driver... program, Jdbc-Odbc bridge driver create connection between java application
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
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 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
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
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
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
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
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
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 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
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
comes with ODBC driver therefore you should use JDBC - ODBC bridge driver... to the database table name. Now Create a Data Source Name using Microsoft  Excel... .style1 { background-color: #FFFFCC; } XLS JDBC XlS JDBC driver
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 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
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
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 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
retrieve data from mysql database
retrieve data from mysql database  hi am not familiar in php.....even... selected value on combobox which is to be retrieve the relevant data from mysql database using php.... below my code is that.. <html> <head>
JDBC-Odbc Connection
JDBC-ODBC Connection       JDBC-ODBC Connection is a JDBC driver that translates the operation in  JDBC into ODBC. For ODBC,it is a normal java application program. This bridge
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
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 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 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
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 using combo box value in jsp? - JSP-Servlet
How to retrieve data using combo box value in jsp?  Hi freind, I already post this question. I need urgent help from u. pl response me.... All actions in the same page.......  Hi Friend, Please visit
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
Retrieve Data into JTable and export it to Excel File
Java Retrieve Data into JTable and export it to Excel File In this section, you will learn how to retrieve the data from the database... it into Vector which is then added to table. To export the table data to excel file, we
How To Retrieve Image From From MySQL Using Java
How To Retrieve Image From From MySQL Using Java In this section we will discuss about how to retrieve image from the MySQL using Java. This example explains you about all the steps that how to retrieve image from MySQL database
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
how to retrieve data from database using combobox value without using request.getParameter in jsp - JSP-Servlet
how to retrieve data from database using combobox value without using request.getParameter in jsp  Answer pl
How many ways we can retrieve the date in result set of mysql using php?
How many ways we can retrieve the date in result set of mysql using php?  How many ways we can retrieve the date in result set of mysql using php
How many ways we can retrieve the date in result set of mysql using php?
How many ways we can retrieve the date in result set of mysql using php?  How many ways we can retrieve the date in result set of mysql using php
How many ways we can retrieve the date in result set of mysql using php?
How many ways we can retrieve the date in result set of mysql using php?  How many ways we can retrieve the date in result set of mysql using php
How many ways we can retrieve the date in result set of mysql using php?
How many ways we can retrieve the date in result set of mysql using php?  How many ways we can retrieve the date in result set of mysql using php
How many ways we can retrieve the date in result set of mysql using php?
How many ways we can retrieve the date in result set of mysql using php?  How many ways we can retrieve the date in result set of mysql using php
How many ways we can retrieve the date in result set of mysql using php?
How many ways we can retrieve the date in result set of mysql using php?  How many ways we can retrieve the date in result set of mysql using php
How many ways we can retrieve the date in result set of mysql using php?
How many ways we can retrieve the date in result set of mysql using php?  How many ways we can retrieve the date in result set of mysql using php
how to retrieve image from mysql database using java and show it in HTML img tag ?
how to retrieve image from mysql database using java and show it in HTML img tag ?  how to retrieve image from mysql database using java and show it in HTML img tag
How to retrieve data by using combo box value in jsp? - JSP-Servlet
How to retrieve data by using combo box value in jsp?  Hi Friends... related value.... I am using only this page.. not get value from another page... in combo box from database.. by using select*from studentinformation; But when i
php import data from excel to mysql
php import data from excel to mysql  php import data from excel to mysql
online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.
online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.  please provide online quiz program coding using jsp, jdbc...").newInstance(); Connection connection = DriverManager.getConnection("jdbc:mysql
how to read data from excel file through browse and insert into oracle database using jsp or oracle???
how to read data from excel file through browse and insert into oracle database using jsp or oracle???  sir.. i have number of excel sheets which... then you can change the JDBC Driver and the url according to Oracle. http

Ads