Subject | Re: [Firebird-Java] how to insert?? |
---|---|
Author | William L. Thomson Jr. |
Post date | 2003-07-31T15:13:02Z |
On Thu, 2003-07-31 at 11:00, Daniel Bertin wrote:
StringBuffer sb = new StringBuffer();
sb.append("INSERT INTO TABLE (FIELD1,DATEFIELD2,FIELD3)");
sb.append(" VALUES (");
sb.append(variable1);
sb.append(",'NOW',");
sb.append("variable2)");
String sq = sb.toString();
Then you pass sq along as your query.
When you use :variable that syntax to be used within the db itself. Via
triggers or stored procs. It will cause you problems in Java as you
already have discovered.
--
Sincerely,
William L. Thomson Jr.
Support Group
Obsidian-Studios, Inc.
http://www.obsidian-studios.com
> Hi all,One way is
>
> How do I insert a java variable with jaybird? :variable gives me an error
>
> INSERT INTO TABLE (FIELD1,DATEFIELD2,FIELD3)
> VALUES (:variable1,'NOW', :variable2)
StringBuffer sb = new StringBuffer();
sb.append("INSERT INTO TABLE (FIELD1,DATEFIELD2,FIELD3)");
sb.append(" VALUES (");
sb.append(variable1);
sb.append(",'NOW',");
sb.append("variable2)");
String sq = sb.toString();
Then you pass sq along as your query.
When you use :variable that syntax to be used within the db itself. Via
triggers or stored procs. It will cause you problems in Java as you
already have discovered.
--
Sincerely,
William L. Thomson Jr.
Support Group
Obsidian-Studios, Inc.
http://www.obsidian-studios.com