• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MS EXCEL Connect

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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....
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to look at the POI Api, where you can iterate over each row in Excel - read/write.
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.)
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.)
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic