Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Import excel to mysql

 
anvi kon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21137
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 979
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
shaileshkumar mistry
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic