This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other Languages and the fly likes Import excel to mysql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Languages » Other Languages
Bookmark "Import excel to mysql" Watch "Import excel to mysql" New topic
Author

Import excel to mysql

anvi kon
Ranch Hand

Joined: Jan 08, 2010
Posts: 133
Hi,
I have huge excel 60k data.Is any open source tool to import an excel to mysql database table?

Please let me know as soon as possible?

Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Why do you need an open-source tool?

If it were me I would just set up a table with a large-binary column (or whatever MySQL calls that), then use a PreparedStatement with an INSERT command and the setBinaryStream() method to connect the PreparedStatement with an InputStream pointing to your Excel document.

(Which isn't "huge" if it's only 60K. "Huge" is where it's several megabytes.)
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 867
    
    5
Paul Clapham wrote:
If it were me I would just set up a table with a large-binary column


You seem to assume that the whole document has to be inserted into a BLOB.

It is not only conceivable but it is even more likely that the tabular data have to be inserted.

One could export the document in a textual form (csv or the like) and with the help of a decent text editor
(or of a special purpose program) a series of insert statements could be generated thereof.
shaileshkumar mistry
Greenhorn

Joined: Dec 19, 2011
Posts: 19
Hi

You can create a simple JDBC program to insert data from excel to your mysql database

what you need to do is create a dns connection with Excel. and use that DNS name while connecting to excell sheet.



Thanks and Regards

OCPJP 100%
shaileshkumar mistry
Greenhorn

Joined: Dec 19, 2011
Posts: 19
Please find the below code for connection and retrive table names

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbcdbc:ex_dns_name");

Statement st = con.createStatement();
DatabaseMataData dbmd = con.getMetaData();
ResultSet rs = dbmd.getTables(null, null, null, null);

while (rs.next())
table_Name.add(rs.getString("TABLE_NAME"));
}

You can use table names to fetch data in different excel sheets in your excel file
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9956
    
163

Paul Clapham wrote:

(Which isn't "huge" if it's only 60K. "Huge" is where it's several megabytes.)


I think the original poster meant the number of records in the file and not the size of the file. Either way, 60K isn't really a huge number.

[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Import excel to mysql
 
Similar Threads
import excel data into mysql database?
using excel file
importing data from excel to Mysql database using jsp code
excel from java
import data from excel file into MYSQL database