Hi guys,
I have a form, I pass certain values to another file which validates the data.
After validation the data is entered into a single table of a database. The problem is I have 2 different databases with exactly the same schema but different database and table names, the database are also located on a different server.
I need to enter the exact same data in both the databases. I tried initially entering the data into one of he tables and it worked fine, however when i try to enter it in both the databases it only works for the first one and nothing is populated in the second database.
Here is the code:
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url="jdbc:mysql://***.***.***.205/aovoice";
Connection Conn=DriverManager.getConnection(url,"vmc","1794x");
Statement stmt = Conn.createStatement();
int rs = stmt.executeUpdate( "UPDATE users SET email = '"+request.getParameter("vemail")+"', fullname = '"+request.getParameter("firstname")+" "+request.getParameter("surname")+"' WHERE mailbox = '"+request.getParameter("mailbox")+"'");
stmt.close();
Conn.close();
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url2="jdbc:mysql://***.***.***.209/alwayson";
Connection Conn2=DriverManager.getConnection(url2,"vmc","1794x");
Statement stmt2 = Conn2.createStatement();
int rs2 = stmt2.executeUpdate( "UPDATE voicemail SET email = '"+request.getParameter("vemail")+"', fullname = '"+request.getParameter("firstname")+" "+request.getParameter("surname")+"' WHERE mailbox = '"+request.getParameter("mailbox")+"'");
stmt2.close();
Conn2.close();
What am i doing wrong?
I have a form, I pass certain values to another file which validates the data.
After validation the data is entered into a single table of a database. The problem is I have 2 different databases with exactly the same schema but different database and table names, the database are also located on a different server.
I need to enter the exact same data in both the databases. I tried initially entering the data into one of he tables and it worked fine, however when i try to enter it in both the databases it only works for the first one and nothing is populated in the second database.
Here is the code:
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url="jdbc:mysql://***.***.***.205/aovoice";
Connection Conn=DriverManager.getConnection(url,"vmc","1794x");
Statement stmt = Conn.createStatement();
int rs = stmt.executeUpdate( "UPDATE users SET email = '"+request.getParameter("vemail")+"', fullname = '"+request.getParameter("firstname")+" "+request.getParameter("surname")+"' WHERE mailbox = '"+request.getParameter("mailbox")+"'");
stmt.close();
Conn.close();
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url2="jdbc:mysql://***.***.***.209/alwayson";
Connection Conn2=DriverManager.getConnection(url2,"vmc","1794x");
Statement stmt2 = Conn2.createStatement();
int rs2 = stmt2.executeUpdate( "UPDATE voicemail SET email = '"+request.getParameter("vemail")+"', fullname = '"+request.getParameter("firstname")+" "+request.getParameter("surname")+"' WHERE mailbox = '"+request.getParameter("mailbox")+"'");
stmt2.close();
Conn2.close();
What am i doing wrong?