Using Derby as my database driver and tying to complete SQL query through java, there is a error which was encounter, when attempted to complete this specific query

stmt.executeQuery("insert into " + "TEST " + "values (" + dataTimeRev + ", " 
                                  + dataType + "," + obj + ")" );

Here dataTimeRev, dataType and obj are variables with data.

The mistake which was mentioned was such as this

java.sql.SQLSyntaxErrorException: VALUES clause must contain at least one element. Empty elements are not allowed. 

when the column data type is VARCHAR you'll have to pass the worthiness in qoutes like 'value' for your you want to do as below

String query = "insert into TEST values('"+dataTimeRev+"', '"+dataType+"','"+obj+"')";
stmt.executeQuery(query);
  1. Verify that dataTimeRev, dataType and obj aren't null and never blank.
  2. I don't know if Derby follows SQL syntax. But when the values are of type varchar, then it ought to be enclosed in single quotes ('). For instance:

stmt.executeQuery("place into " + "TEST " + "values ('" + dataTimeRev + " ', ' " + dataType + " ',' " + obj + " ')" )

Do this:

stmt.executeQuery("insert into TEST values ('" + dataTimeRev + "', "'+ dataType + "',"' + obj + "')" );