Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> inserting java.sql.date into a oracle 8i table
I was wondering if any one can help me I am trying to insert a date into an oracle table from a servlet. This is the code I am using sqlMesDate = new java.sql.Date(System.currentTimeMillis());
String query = "INSERT INTO MessageBoard VALUES ('" + subject + "','" + name + "','" + email + "'," + sqlMesDate + ",'" + message + "')" ;
try
{
Connection dbConnection = tools.getDatabaseConnection();
Statement statement = dbConnection.createStatement();
result = statement.executeUpdate(query);
dbConnection.close();
}catch (SQLException sqle)
{
out.println(tools.getHtml("DatabaseError.htm")); out.println("<BR>" + sqle); out.close();
this is the error I get
java.sql.SQLException: ORA-00932: inconsistent datatypes
Received on Thu Apr 27 2000 - 00:00:00 CDT