0

Hi I am currently testing out a large PreparedStatement, but I seemed to be stuck in the rut. At the moment I have an error "Caused by: Error : 933, Position : 243"

Here is my code for reference:

//Create a query string
    String sqlQuery=null;
    sqlQuery="insert into tbl_email_template(template_code,template_file_name,template_file,status,"
            + "system,type,email_from,email_subject,email_reply_to,email_content,uploaded_by,"
            + "dcreate,dmodify) values(?,?,?,?,?,?,?,?,?,?,?,?,?);";

    System.out.println(sqlQuery);
    System.out.println("Total:"+rsmd.getColumnCount());
    Clob clob = con.createClob();

    File file = new File("template.msg");
    MapiMessage msg = MapiMessage.fromFile(file.toString());
    FileInputStream fis = new FileInputStream(file);

    clob.setString(1, msg.getBody());

    Date date = new Date(1,2,3);

    PreparedStatement pstmt = con.prepareStatement(sqlQuery);
    pstmt.setString(1, "haha");
    pstmt.setString(2, file.getName());
    pstmt.setBlob(3, fis,file.length());
    pstmt.setString(4, "A");
    pstmt.setString(5, "MRS");
    pstmt.setString(6, "BK");
    pstmt.setString(7, "[email protected]");
    pstmt.setString(8, msg.getSubject());
    pstmt.setString(9, "[email protected]");
    pstmt.setClob(10, clob);
    pstmt.setString(11, "Generic User123");
    pstmt.setDate(12,date);
    pstmt.setDate(13,date);
    pstmt.execute();

    System.out.println("Done");
2
  • show your full error Commented Jun 23, 2017 at 4:04
  • maybe use executeUpdate Commented Jun 23, 2017 at 4:06

1 Answer 1

1

The ; should be removed:

sqlQuery="insert into tbl_email_template(template_code,template_file_name,template_file,status,"
        + "system,type,email_from,email_subject,email_reply_to,email_content,uploaded_by,"
        + "dcreate,dmodify) values(?,?,?,?,?,?,?,?,?,?,?,?,?);";

should read:

sqlQuery="insert into tbl_email_template(template_code,template_file_name,template_file,status,"
        + "system,type,email_from,email_subject,email_reply_to,email_content,uploaded_by,"
        + "dcreate,dmodify) values(?,?,?,?,?,?,?,?,?,?,?,?,?)";

For the rest: I can not count the characters as given from your error, so your error might or might not be solved by this....

Sign up to request clarification or add additional context in comments.

8 Comments

Yes, look at the comments at the accepted answer there regarding the multiple statements and semi column
what multiple statements has this OP got? One single insert
Still the ; works disruptive in this. That is not said that it is the error observed. So the user will have to test and see if it resolves (user seems to be offline).
see also stackoverflow.com/questions/10914269/… -- basically it would appear that your answer (at best) not useful or (at worst) is wrong
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.