Did you check your primary key implements auto-increment? if it's not the case you must enable null to be send to the database in a insert statement.
Did you try SELECT statements ?? Xavier XP> -----Message d'origine----- XP> De : jsp [mailto:[EMAIL PROTECTED] XP> Envoy� : mardi 25 mars 2003 07:17 XP> � : 'Tomcat Users List' XP> Cc : [EMAIL PROTECTED] XP> Objet : Cannot Update MYSQL Database XP> XP> XP> I'm running this code with no errors but it's not inserting the string XP> into the database ? XP> XP> public void addInfo( String referer ) XP> throws SQLException, Exception { XP> if (con != null) { XP> try{ XP> XP> PreparedStatement updateInfo; XP> updateInfo = con.prepareStatement( XP> "insert into info(?)"); XP> updateInfo.setString(1, referer ) XP> updateInfo.execute(); XP> XP> XP> XP> } XP> catch (SQLException sqle){ XP> sqle.printStackTrace(); XP> } XP> } XP> else { XP> error = "Connection with database was lost."; XP> throw new Exception( error ); XP> } XP> } XP> XP> This is my database XP> mysql> desc info; XP> +---------+-----------+------+-----+---------+-------+ XP> | Field | Type | Null | Key | Default | Extra | XP> +---------+-----------+------+-----+---------+-------+ XP> | ID | int(11) | | PRI | 0 | | XP> | REFERER | char(200) | YES | | NULL | | XP> +---------+-----------+------+-----+---------+-------+ XP> 2 rows in set (0.00 sec) XP> XP> Any Idea why nothing is showing up. Referer is a String its printing out XP> on the page but not updating the database? XP> XP> Thanks anyone XP> -wiley XP> XP> XP> XP> XP> --------------------------------------------------------------------- XP> To unsubscribe, e-mail: [EMAIL PROTECTED] XP> For additional commands, e-mail: [EMAIL PROTECTED] XP> XP> XP> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
