| 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: 16483
|
|
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
Ranch Hand
Joined: May 22, 2012
Posts: 380
|
|
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("jdbc dbc: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: 8142
|
|
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]
|
 |
 |
|
|
subject: Import excel to mysql
|
|
|