I think you probably need to do one of the following;

Insert into info set referer = ?

Or

Insert into info (referer) values (?)

But I could be wrong. 



-----Original Message-----
From: jsp [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 25 March 2003 07:17
To: 'Tomcat Users List'
Cc: [EMAIL PROTECTED]
Subject: 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

   


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to