"where and how do I indicate that there is a problem insert a row into the table 'message'?"
I don't understand you there. INSERT INTO message(thread_topic, thread_body) VALUES ('This is a topic','This is the body.'); That should work just fine. -----Original Message----- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Thursday, December 25, 2003 2:37 PM To: [EMAIL PROTECTED] Subject: How Do I Insert ...... ? I have a table 'message' in the MySQL database. To make it simple; say, I have three fields in that table: thread_ID, thread_topic, and thread_body. The thread_ID field is AUTO_INCREMENT; therefore, I do not insert any value into that column. The value of that field starts with 1 when the first row is inserted. Now, I have the values for thread_topic and thread_body and want to insert those values into the 'message' table to create the first record in that table. 1. where and how do I indicate that there is a problem insert a row into the table 'message'? 2. Do I code this way: protected static void create(String threadTopic, String threadBody) throws CreateException, DatabaseException, ForeignKeyNotFoundException { StringBuffer sb = new StringBuffer(512); sb.append("INSERT INTO " + message + "(thread_topic, thread_body)"); sb.append(" VALUES (?, ?)"); try { Connection conn = DBConnection.getDBConnection(); Statement stmt = conn.createStatement(sb.toString()); stmt.setString(1, threadTopic); stmt.setString(2, threadBody); } catch(SQLException sqle) { sqle.printStackTrace(); throw new DatabaseException("Error executing SQL in ThreadHelper.create."); } finally { stmt.close(); conn.close(); } } __________________________________ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ -- 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]