You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Molnar <mo...@mac.com> on 2006/05/23 17:17:15 UTC

Question on csv import using browser into MySQL database

Hello,

I need to ask a question from any of the java experts out there. Can 
anyone suggest or share a code segment that allows a web user to upload 
a csv file and then parse it on the server end with the end goal of it 
going into a mysql table?

I have searched everything I can think to search but can't find anything.

Thanks,
-Chris


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Question on csv import using browser into MySQL database

Posted by Marc Farrow <ma...@gmail.com>.
Once you use the apache project's fileupload class you can just use a simple
filereader to read through the file record by record and use the
split(String regex) method from the String class to split the data into a
string array.  Then loop through array and write the sql statements to
update your database.

On 5/23/06, Juan Jose Garcia Lau <jg...@cuscatlanguate.com> wrote:
>
> If you want to upload files, take a look at
>
> http://jakarta.apache.org/commons/fileupload/
>
> Cheers,
>
> Juan
>
> -----Original Message-----
> From: Christopher Molnar [mailto:molnarc@mac.com]
> Sent: Martes, 23 de Mayo de 2006 10:17 a.m.
> To: Tomcat Users List
> Subject: Question on csv import using browser into MySQL database
>
> Hello,
>
> I need to ask a question from any of the java experts out there. Can
> anyone suggest or share a code segment that allows a web user to upload
> a csv file and then parse it on the server end with the end goal of it
> going into a mysql table?
>
> I have searched everything I can think to search but can't find
> anything.
>
> Thanks,
> -Chris
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
> This message contains information from Banco Cuscatlan Guatemala, which
> may be confidential
> and privileged.  If you are not an intended recipient, please refrain from
> any
> disclosure, copying, distribution or use of this information and note that
> such actions are prohibited.  If you have received this transmission in
> error,
> please disregard it.
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Marc Farrow

RE: Question on csv import using browser into MySQL database

Posted by Juan Jose Garcia Lau <jg...@cuscatlanguate.com>.
If you want to upload files, take a look at

http://jakarta.apache.org/commons/fileupload/

Cheers, 

Juan 

-----Original Message-----
From: Christopher Molnar [mailto:molnarc@mac.com] 
Sent: Martes, 23 de Mayo de 2006 10:17 a.m.
To: Tomcat Users List
Subject: Question on csv import using browser into MySQL database

Hello,

I need to ask a question from any of the java experts out there. Can 
anyone suggest or share a code segment that allows a web user to upload 
a csv file and then parse it on the server end with the end goal of it 
going into a mysql table?

I have searched everything I can think to search but can't find
anything.

Thanks,
-Chris


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




This message contains information from Banco Cuscatlan Guatemala, which may be confidential
and privileged.  If you are not an intended recipient, please refrain from any
disclosure, copying, distribution or use of this information and note that
such actions are prohibited.  If you have received this transmission in error,
please disregard it.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Question on csv import using browser into MySQL database

Posted by Mark Matthews <ma...@mysql.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tim Lucia said the following on 5/23/2006 10:51 AM:
> I've used a CSV JDBC driver once before with success.  It becomes an
> exercise of reading from one JDBC connection and writing to the other.
>
> http://csvjdbc.sourceforge.net
>
> Tim

Christopher,

If you don't mind being MySQL-specific, you can always use "LOAD DATA
LOCAL INFILE" with our JDBC driver. This will send the "local" file from
your application server to the MySQL server for parsing/processing
directly into table(s), see:

http://dev.mysql.com/doc/refman/5.0/en/load-data.html

	-Mark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEc2KXtvXNTca6JD8RAkSDAJ42MPHCuSrYX9A0f6PZgVjn2jj2pACgl61e
zvbyvT6frUkDXoI/leiWiNE=
=6Cbt
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Question on csv import using browser into MySQL database

Posted by Tim Lucia <ti...@yahoo.com>.
I've used a CSV JDBC driver once before with success.  It becomes an
exercise of reading from one JDBC connection and writing to the other.

http://csvjdbc.sourceforge.net

Tim

(I posted this same answer on java@lists.mysql.com and include it here for
archival completeness.)


-----Original Message-----
From: Christopher Molnar [mailto:molnarc@mac.com] 
Sent: Tuesday, May 23, 2006 11:17 AM
To: Tomcat Users List
Subject: Question on csv import using browser into MySQL database

Hello,

I need to ask a question from any of the java experts out there. Can 
anyone suggest or share a code segment that allows a web user to upload 
a csv file and then parse it on the server end with the end goal of it 
going into a mysql table?

I have searched everything I can think to search but can't find anything.

Thanks,
-Chris


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org