aspose file tools*
The moose likes JDBC and the fly likes MS EXCEL Connect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MS EXCEL Connect " Watch "MS EXCEL Connect " New topic
Author

MS EXCEL Connect

S Kazi
Greenhorn

Joined: Aug 18, 2008
Posts: 15
Hi, Friends I am new to JDBC I know how to connect the java prog to access with the help of type 1 driver can any one help me how to connect M S excel file to java .. help me from basic i dont know how to connect i was trying from last 10 days....
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

You need to look at the POI Api, where you can iterate over each row in Excel - read/write.


Regards, Rene Larsen
Dropbox Invite
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

"SK"

Welcome to JavaRanch. Please look carefully at the official naming policy at Javaranch & reregister yourself with a proper first & last name, with a space between them. Initials may be used for a first name, but not a last name. Please adhere to official naming policy & help maintain the decorum of the forum. The naming policy can be found at http://www.javaranch.com/name.jsp


My Blog: Down Home Country Coding with Scott Selikoff
Gangadhar Jagani
Greenhorn

Joined: Jul 09, 2008
Posts: 1
To access a database management system (DBMS) in Java, you need a JDBC (Java Database Connectivity) driver. You may write such drivers, which range from types 1 to 4, in pure Java or a combination of Java and Java Native Interface (JNI) methods. The industry trend is towards the more robust types 3 and 4 pure-Java drivers. Type 3 drivers shine when supporting Internet deployment in environments that connect to a variety of DBMS servers requiring numerous concurrently connected users where performance and scalability are major concerns. Therefore, to develop a high-performance, Internet-deployable application, you'll often find it useful to convert your existing type 1 or 2 drivers to type 3 drivers.

Read the whole "Create Your Own Type 3 JDBC Driver" series:

Part 1: Connect your Java applications to databases�the easy way
Part 2: Compile, deploy, and access data using your custom-built JDBC driver
Part 3: Enhance the custom JWDriver with advanced logging, connection pooling, and Predefined Data Sets



In this three-part series, we first introduce our own type 3 JDBC driver's architecture and design (Part 1), then show how to implement and deploy the driver (Part 2), and finish by explaining how you can add advanced features to the driver, like SQL logging or connection pooling (Part 3).

Note: Before you read this article, you may wish to read Nitin Nanda's "JDBC Drivers in the Wild" (JavaWorld, July 2000) to better understand JDBC drivers.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42622
    
  65
Gangadhar Jagani,

welcome to JavaRanch. What you posted seems copied from somewhere; you need to provide the source from where you got that, lest it look like plagiarism. (I also fail to see how it helps answer the original question, but that's besides the point.)


Ping & DNS - my free Android networking tools app
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42622
    
  65
This article show show to set up an ODBC connection to an XLS file: http://www.javaworld.com/javaworld/javaqa/2001-06/04-qa-0629-excel.html

I found that by googling for "excel jdbc", by the way.
[ August 22, 2008: Message edited by: Ulf Dittmer ]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

Originally posted by Ulf Dittmer:
Gangadhar Jagani,

welcome to JavaRanch. What you posted seems copied from somewhere; you need to provide the source from where you got that, lest it look like plagiarism.
Yes, it was copied from http://www.roseindia.net/software-tutorials/detail/3723.

(Ironically it is easier to read here than it is in its original location, where it's crammed in among a sea of advertising.)
benjamin muktesh
Greenhorn

Joined: Jul 01, 2008
Posts: 24
If you just want to import data from a database into excel you don't need JDBC to do that. A bit of SQL and Excel knowledge should take you through.
Excel has an inbuilt query wizard which allows you to connect to a database and execute queries.
I will start you off in the right direction:

Open an excel sheet
Click on data->Import External Data->New database query
This will open data source selector
While on database tab select <New data source> and hit ok
Now you can select whatever is applicable in your case and start writing queries.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42622
    
  65
If you just want to import data from a database into excel you don't need JDBC to do that.[/QB]

The original post explicitly states "can any one help me how to connect MS excel file to java", so using Excel manually doesn't solve the problem.

If this was my problem I'd use POI, not JDBC, though.
 
Consider Paul's rocket mass heater.
 
subject: MS EXCEL Connect