have been trying this program fr 2 days now please help someoneU have a url whose result is somewhat likeUsername1= xxx,username2=yyy.....40 values.....We need to read the response of the url and insert it in database....where already a table is present with all keys(username1,username2,..) as header fields...we need to insert their values dynamically...the keys may not be in the same order in database as in url response..... i was able to get response and store it in a string array but am unable to get any idea on how to insert only values dynamically ...............Ill be very thankful if someone can help
Indeed. Please format your posts to make easily readable.
As for your question, what I understand is that you have a Servlet in which you received and process 40 query string items and you'd like to store the values in a database where the same keys exist. So far you've parsed the key-value pairs into an Array. If this is correct, in the simplest form, you'll ought to create a middle tier class in which you use JDBC to connect to your database and execute an UPDATE command. I recommend using database stored procedures instead of writing the SQL command in your database.
and the table would have username1,username2,username3,username4......as headers,i need to insert the values(i.e sudeep,kiran,jai...) according to their respective keys.
Now i have tried putting them into a map because i thought i could make them into key,values and insert the values into database with respect to their keys but i am unable to get any idea on how to do it.
Hope this information is enough,i will provide more if asked
First thing first, it seems that the key-value pairs aren't in the URL but in the content of the HTTP response (you're parsing the content).
Like I mentioned, in order to update the database, the bare minimum you need to do is to use JDBC and execute an "Update" SQL command for each pair which updates the values.
Are you facing any specific problem or you just don't know how to connect to DB from within your code?