• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 141
  • Last Modified:

Servlets and Databases (msterjev again) and the other experts

I did not say it was wrong msterjev.

The thing is I am trying to insert one value into 2 tables contained in the database after checking whether it already exist or not and then give a message if it does or continue adding to the two specified tables in the servlet code. eg if a name is entered in the html page . the servlet should be able to add it into the two tables. I quite aware that you can be helpful again. Sample codes will be appreciated.

And (msterjev) thank you for the loggin servlet sample code which can be easily understood.

Thank

You
0
wbmorapedi
Asked:
wbmorapedi
  • 2
1 Solution
 
msterjevCommented:
Could you remaind me which code I gave to you was wrong, and what is problem with that code?
0
 
msterjevCommented:
I think this can help you:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          Connection connection=DriverManager.getConnection("jdbc:odbc:Imenik");
          Statement statement=connection.createStatement();
statement.executeUpdate("INSERT INTO Table1 VALUES(....));
statement.executeUpdate("INSERT INTO Table2 VALUES(....));
statement.close();
connecitonc.close();


You can transfer user's data across the servlets using Session.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now