Link to home
Start Free TrialLog in
Avatar of VbMonk
VbMonk

asked on

Loading contents of a *.CSV file into a database

I have a *.csv file whose contents I want to add into a database. How can I possibly do this using Javascript or JSP?

Monk
Avatar of petmagdy
petmagdy
Flag of Canada image

From JSP these are summary steps:

1- using java.io, read the CSV line by Line, each line into a String
2- if it is comma delimited, for each line use:

String[] fields = String.split("[,]');

u will get what represents the Single Record fields in the fields String Array

3- For each line use JDBC to insert into dataase, by a SQL statment like this:

insert into mytable values( {ur fields} );

ASKER CERTIFIED SOLUTION
Avatar of DrWarezz
DrWarezz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
DrWarezz, thanks your good value add and elaboration, deserves all the points thanks
Avatar of DrWarezz
DrWarezz

:-) No, I insist.  I honestly would feel like a 'point-theif' if I were to get the points, as you've answered the Q, I just elaborated a bit, because I felt that the author clearly wasn't TOO confident on how to do this. :-)

So, author; no matter what petmagdy says, give him the points  :-)

[r.D]
no "point-theif" u gived the answer more intension than me and provided value add, author best solution to split

but wait a minute where is the author? seems not interested any more ;-)
more attension i mean, miss tepo, hhhhhhhhhh LOOOLLLLLLLLLLL
lol -- it makes sense either way ;-)
Okay.. thanks, VbMonk  :-)

[r.D]