handling multiple queries with the same connection
satya sxy
Greenhorn
Joined: Mar 23, 2001
Posts: 13
posted
0
Hello someone, I am trying to use javaservlets and jdbc for a project i am working on. I have a register servlet that does the registration part. When i submit this servlet,it should first check the database table if the username already exists ,if it exists then it do nothing. in case if the submitted username doesnt exist then the submitted information should be inserted into the database table. I tried doing this but i get erorrs. could someone throw light on this topic as to how to handle both the select query and insert query one after the other. Any help, ideas, suggested readings are appreciated. thanks, shailu.
algorithm: connect query the table for the username if username does not exist write to the database
I didn't compile the above code, but it should give you a start. As you can see, I prefer PreparedStatements over Statements in any situation that I can! Jamie
satya sxy
Greenhorn
Joined: Mar 23, 2001
Posts: 13
posted
0
Thanks jamie, i will try this one. I appreciate your help. thanks a lot. shailu