Subject | Re: how to insert?? |
---|---|
Author | Roman Rokytskyy |
Post date | 2003-07-31T15:31:40Z |
> How do I insert a java variable with jaybird? :variable gives me anIf you use java.sql.PreparedStatement, use following:
> error
>
> INSERT INTO TABLE (FIELD1,DATEFIELD2,FIELD3)
> VALUES (:variable1,'NOW', :variable2)
>
PreparedStatement stmt = con.prepareStatement(
"INSERT INTO my_table(field1, datefield2, field3) " +
"VALUES (?, 'NOW', ?)");
stmt.setString(1, someValueOfTheField1);
stmt.setInt(2, someValueOfTheField3);
stmt.excecute(); // or stmt.executeUpdate();
Best regards,
Roman Rokytskyy