Hi ,

Hey I have a small problem.... For a certain field in database, tha values are sent from front end(JSP page) . Each individual value must be extracted and then inserted into the database.....
Before inserting, we have called a procedure which will extract each value and insert....
Moreover , it is only for the first value that we must insert. For all the remaining values , we have to update......


We are stuck up with this..... and some of the attempts we made aren't working.... :(

Can anyone give an idea as to how to implement this code................

what we do in php is, open the csv file using fopen. Then using the filepointer of fopen, we store the csv values in an array. Then access that array. for example, (in php ie.,)

<?php
$fp = fopen("test.csv", "r"); //open the csv file
while ($contents = fgetcsv ($fp, 1000, ";")) { // fetch the contents of the csv file. ';' is the delimiter of the fields in csv file
		$name=$contents[0]; //first element of array $contents has $name	
//insert to table
$age=$contents[1]; //age is the 2nd element of array
//update the table
}
?>

Look for a similar function in jsp. (to open the file and get the contents of csv).

Hope it helps.
Naveen

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.