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



Home Answers Viewqa JDBC connect jdbc to an Excel spreadsheet

Have Programming Question? Ask it here!
 
 
 


samar
connect jdbc to an Excel spreadsheet
1 Answer(s)      3 years and 10 months ago
Posted in : JDBC


hello,

How can I connect to an Excel spreadsheet file using jdbc?


Advertisement
View Answers

October 26, 2010 at 11:14 AM


Hello Friend,

Follow these steps:

  1. Open Data Sources (Start->Settings->Control Panel->Administrative Tool->Data Sources(ODBC)
  2. Open User DSN tab
  3. Add a user DSN
  4. Select Microsoft Excel Driver(*.xls)
  5. Select work book or excel file and Create the DSN name (e.g excel)
  6. Click "Ok" and restart your compiler.
  7. 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.

Thanks



Related Tutorials/Questions & Answers:
connect jdbc to an Excel spreadsheet
connect jdbc to an Excel spreadsheet  hello, How can I connect to an Excel spreadsheet file using jdbc?   Hello Friend, Follow..."); Connection conn = DriverManager.getConnection("jdbc:odbc:excel
how to connect xlsx(2007 excel) - JDBC
how to connect xlsx(2007 excel)  i am not able connect to office 2007 excel file from jdbc
Advertisements
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
Create SpreadSheet same as excel using java applet
Create SpreadSheet same as excel using java applet  Hi Ji, May i know to create new excel sheet using java Applet
Create SpreadSheet same as excel using java applet
Create SpreadSheet same as excel using java applet  Hi Ji, May i know to create new excel sheet using java Applet
How to insert rows from Excel spreadsheet into database by browsing the excel file?
How to insert rows from Excel spreadsheet into database by browsing the excel file?  I want to insert rows from excel sheet to database.for this i... the excel file using file browsing dialogue through form in JSP. How can i select
How to retrieve file name and path of an excel spreadsheet imported into Oracle Database
How to retrieve file name and path of an excel spreadsheet imported into Oracle Database  I imported an excel spreadsheet using sql developer into my... table for each spreadsheet but I want to obtain the path and filename of each
JDBC to EXcel
JDBC to EXcel  How to insert data in excel sheet from java
how to connect mysql with JDBC - JDBC
how to connect mysql with JDBC  I have created three tables in the database MYsql, i have to connect them now using JDBC, can u please suggest me...(); } } Thanks Rajanikant  Hi friend, To mysql connect using JDBC
could not connect to the server - JDBC
could not connect to the server  Hii sir, I am working with a JBDC program now. Now i am trying to host it. when i am trying to connect...: Connection timed out: connect STACKTRACE: java.net.SocketException
Use JDBC to connect Microsoft Access
Use JDBC to connect Microsoft Access  How to use JDBC to connect Microsoft Access
cannot connect to database - JDBC
cannot connect to database  Iam using eclipse in my system ,when connecting the database mysql version 5.0 to the eclipse iam getting an error as ""Creating connection to mysql has encountered a problem.Could not connect to mysql
how to connect jdbc
how to connect jdbc  package com.tcs.ilp.Try.Controller; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import
not able to connect to mysql using.. jdbc
not able to connect to mysql using.. jdbc   i am not able to connect to mysql using jdbc .. is there any classpath that i need to set..because i am using mysql-connector-java jar file..to connect to mysql.. Pls provide the steps
JDBC Connection code to connect servlet with oracle.
JDBC Connection code to connect servlet with oracle.  JDBC Connection code to connect servlet with oracle
write spreadsheet
write spreadsheet  what is the java code to write a spreadsheet to database
write spreadsheet
write spreadsheet  what is the java code to write a spreadsheet to database
Java and excel - JDBC
to a Jtable from where i can export to excel, i will like to format the column headers in excel using code. plz i nd help becos it is my project, as a serious student i tried using the following code but it gives me a distorted records in excel
excel file using JDBC java.?
excel file using JDBC java.?  hey, i am a telecomm. engineer , and i am try to develop a tool which reads from a excel file and then appends the same... used JDBC ODBC to read from excel file. i am not able to append it using
what is ment by jdbc and how to connect with database?
what is ment by jdbc and how to connect with database?  i want answer for this question
Connect to MS Acces wothout using ODBC but JDBC - JDBC
Connect to MS Acces wothout using ODBC but JDBC  Hi, I want to connect my MS Access using JDBC but not ODBC. Please help me out. Thanks
can't connect to MySQL Server(10060) - JDBC
can't connect to MySQL Server(10060)  Hii Sir, I am working... MySQL front end. Can we connect to the MySQL server using the I.P address... write as the subject. Can we connect thorugh a MySQL Frontend. Kindly
exporting data to excel sheet - JDBC
exporting data to excel sheet  Sir i have already send request about... query in java swing program,i want to print the result about the query in excel... = wb.createSheet("Excel Sheet"); try{ Connection con = null
how to connect swings with jdbc... - Java Beginners
how to connect swings with jdbc...  Hi friends, Is it possible, to connect swings with data base like oracle....i want to store data into database..."); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test
Access Excel file through JDBC
Access Excel file through JDBC In this section, you will learn how to access excel file through Jdbc and display records in JTable. As you know Excel comes with an ODBC driver, so we are using JDBC-ODBC bridge driver to connect jdbc
java + excel data +graph - JDBC
java + excel data +graph  i am doin' a project in which i need to take up data from excel sheets and work upon them mathematically and finally draw a graph with the facility of drawing a trendline(in the graph)...also i need
export data from database to excel sheet - JDBC
export data from database to excel sheet  I am facing a problem about exporting required data from database table to ms-excel sheet.i mean whenever I execute a query then result will be display in MS-EXCEL sheet. please give me
JDBC Connection code to connect servlet with SQL Server 2008
JDBC Connection code to connect servlet with SQL Server 2008  Please ans me why it is not connect i use netbeans IDE7.0 Jdk 1.7 i also add... support for JDBC 4.0. i try Avery thing but i m not success so please ans me . My
how can i create a mysql database to connect to this code - JDBC
how can i create a mysql database to connect to this code  i need..."); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/register...("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc
how can i create a mysql database to connect to this code - JDBC
how can i create a mysql database to connect to this code  i need..."); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/register...("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc
Possibility of Creating a Spreadsheet in Java? - Java Beginners
Possibility of Creating a Spreadsheet in Java?  Is it possible to create a spreadsheet (like MS Excel) in java?   hi friend This code... = wb.createSheet("Excel sheet"); HSSFRow row = sheet.createRow((short)0); HSSFCell
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..."); Connection conn = DriverManager.getConnection("jdbc:odbc:excel
iRows
iRows       iRows is a web-based spreadsheet currently in beta with a GUI similar to the traditional desktop-based spreadsheet applications, such as Microsoft Excel and OpenOffice. Read
excel
excel  how to save excel sheet data into the database using poi api... = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root", "root...(); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test
excel
excel  how to read columns values of excel file in java and store in array list in java like col1 col2 2 3 1 7 7 9 then list1 have values of col1 and list2 have values of col2...  
How to connect with database
How to connect with database  jdbc connection
Connect to the database
Connect to the database  how to connect to the database in the iphone
How to connect
How to connect  how to connect to a remote host using jsp? We need to update files to the database of the application on the local machine from the updated database on our webpage
Mysql connect
Mysql connect  i can have a mysql database file and mysql-connector-net .but i have not mysql database. how to connect vb.net thsis database.(C:\Documents and Settings\Admin\My Documents\VB.NET\Stock delna\STC.sql ). plz help me
jdbc - JDBC
JDBC Query to Connect Database  JDBC Query to connect to database  will u supply me the block of code where it throws the exception
Connect database in Access to Netbean?
Connect database in Access to Netbean?  how to connect database in micrsoft access to Netbean?i know it can be connected by using JDBC-ODBC bridge, can i know the steps in connecting the database? Is there any source code
How to connect to MySql Database from Servlet?
will learn the JDBC steps necessary to connect to the MySQL Database and execute... and then connect it through JDBC to show all the records present there. MySql Table...; font-weight: bold; } How to connect to MySql Database from Servlet
unable to connect database in java
unable to connect database in java  Hello Everyone! i was trying to connect database with my application by using java but i am unable to connect...=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};DBQ=E:/Final Project
connect a web page to a database
connect a web page to a database  how to connect a web page to a database
how to connect webcam in html
how to connect webcam in html  how to connect webcam in html.emphasized text
TO connect multiple database
TO connect multiple database  How to connect several database from a single application in java depending upon the user input it will connect to that database
Excel to database
Excel to database  Hi I want to update SQL database with the values from excel using java code. Can you help me
JAVA EXCEL
JAVA EXCEL  How to read the contents of an excel, perform some calculation and wrote the calculated values to another excel using poi
JQuery-What is Connect?
JQuery-What is Connect?   What is Connect in JQuery and how can i use
How to connect mysql with jsp
How to connect mysql with jsp  how to connect jsp with mysql while using apache tomcat
Advertisements
 

 

 

DMCA.com