File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes How to insert data from file excel into DB? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "How to insert data from file excel into DB?" Watch "How to insert data from file excel into DB?" New topic

How to insert data from file excel into DB?

blue sky

Joined: Jul 20, 2003
Posts: 12
Hi all,
Could you please tell me how insert data from Excel file to database.
Example: my excel file include members information (username,pwd,email,fullname). My DB have table member. And I want insert list members from excel to DB
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

"good luck",
It appears that you have changed your name from a valid display name to an invalid display name. Please change it back, accounts with invalid display names get deleted.
This is not a servlet question, I'm moving it to the JDBC forum.
Joel McNary

Joined: Aug 20, 2001
Posts: 1824

Well, you could create an ODBC driver to your Excel file and read and write data that way (using the JDBC-ODBC Bridge). Also, depending on the database, there may already be conversion utilities available (Access and SQL Server have such utils (them being M$), but I think other DBs do as well...)
[ November 19, 2003: Message edited by: Joel McNary ]

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

If possible, from excel save the file as a tab delimited text file. Read the file in, parse the data columns ( use reg. expressions if possible ) then write each line of data to your database. I do have delimited file reader class (for JDK 1.4) that can make this easier if you decide to go that route.
Vladimir Ergovic
Ranch Hand

Joined: Apr 22, 2001
Posts: 63
You have framework to read Excell files on jakarta it is POI.

Vladimir Ergovic
SJ Adnams
Ranch Hand

Joined: Sep 28, 2001
Posts: 925
export as csv, then import using sql-loader
I agree. Here's the link:
subject: How to insert data from file excel into DB?
jQuery in Action, 3rd edition