Subject | RE: [Firebird-Java] How2 save javaobject in Firebird ? |
---|---|
Author | Rick DeBay |
Post date | 2004-12-17T15:39:44Z |
1 is not an object, it is a primitive.
setObject(1, new Integer(1));
And SomeObject must implement java.io.Serializable, and actually be able
to be serialized.
You may want to explore the java.sun.com website, there are quite a few
papers an tutorials. The blueprints section should also prove
interesting.
Rick DeBay
-----Original Message-----
From: mozheyko_d [mailto:mozheyko_d@...]
Sent: Friday, December 17, 2004 7:08 AM
To: Firebird-Java@yahoogroups.com
Subject: [Firebird-Java] How2 save javaobject in Firebird ?
Hi all !
I need to save java-object in Firebird database
I use:
FirebirdSS-1.5.1 - Linux server
FirebirdSQL-1.5.5JDK1.4 - JDBC driver
Table:
create table a(
id integer not null primary key,
rawdata blob
);
insert code:
[code]
...
PreparedStatement statement = connection.prepareStatement("insert
into a values(?, ?);");
Object o = new SomeObject();
statement.setObject(1, 1);
statement.setObject(2, o);
statement.executeUpdate();
...
[/code]
throws exception:
[code]
org.firebirdsql.jdbc.field.TypeConvertionException: Error converting
to object.
at org.firebirdsql.jdbc.field.FBField.setObject(FBField.java:741)
at
org.firebirdsql.jdbc.AbstractPreparedStatement.setObject(AbstractPrepare
dStatement.java:218)
at Test.main(Test.java:37)
[/code]
Yahoo! Groups Links
setObject(1, new Integer(1));
And SomeObject must implement java.io.Serializable, and actually be able
to be serialized.
You may want to explore the java.sun.com website, there are quite a few
papers an tutorials. The blueprints section should also prove
interesting.
Rick DeBay
-----Original Message-----
From: mozheyko_d [mailto:mozheyko_d@...]
Sent: Friday, December 17, 2004 7:08 AM
To: Firebird-Java@yahoogroups.com
Subject: [Firebird-Java] How2 save javaobject in Firebird ?
Hi all !
I need to save java-object in Firebird database
I use:
FirebirdSS-1.5.1 - Linux server
FirebirdSQL-1.5.5JDK1.4 - JDBC driver
Table:
create table a(
id integer not null primary key,
rawdata blob
);
insert code:
[code]
...
PreparedStatement statement = connection.prepareStatement("insert
into a values(?, ?);");
Object o = new SomeObject();
statement.setObject(1, 1);
statement.setObject(2, o);
statement.executeUpdate();
...
[/code]
throws exception:
[code]
org.firebirdsql.jdbc.field.TypeConvertionException: Error converting
to object.
at org.firebirdsql.jdbc.field.FBField.setObject(FBField.java:741)
at
org.firebirdsql.jdbc.AbstractPreparedStatement.setObject(AbstractPrepare
dStatement.java:218)
at Test.main(Test.java:37)
[/code]
Yahoo! Groups Links