You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Wileynet <wi...@wileynet.com> on 2003/03/25 07:14:59 UTC
Cannot Update MYSQL Database
I'm running this code with no errors but it's not inserting the string
into the database ?
public void addInfo( String referer )
throws SQLException, Exception {
if (con != null) {
try{
PreparedStatement updateInfo;
updateInfo = con.prepareStatement(
"insert into info(?)");
updateInfo.setString(1, referer )
updateInfo.execute();
}
catch (SQLException sqle){
sqle.printStackTrace();
}
}
else {
error = "Connection with database was lost.";
throw new Exception( error );
}
}
This is my database
mysql> desc info;
+---------+-----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-----------+------+-----+---------+-------+
| ID | int(11) | | PRI | 0 | |
| REFERER | char(200) | YES | | NULL | |
+---------+-----------+------+-----+---------+-------+
2 rows in set (0.00 sec)
Any Idea why nothing is showing up. Referer is a String its printing out
on the page but not updating the database?
Thanks anyone
-wiley
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org