Bit string type in PreparedStatement
От
bst
Тема
Bit string type in PreparedStatement
Дата
Msg-id
20050414154508.66799.qmail@web50407.mail.yahoo.com
Список
Дерево обсуждения
Bit string type in PreparedStatement bst <bst_co@yahoo.com>
Re: Bit string type in PreparedStatement Oliver Jowett <oliver@opencloud.com>
Getting the number or row returned by a select. Alway tought it was
not possible until I say pgAdmin who gives it David Gagnon <dgagnon@siunik.com>
Re: Getting the number or row returned by a select. Alway Kris Jurka <books@ejurka.com>
I have a table with a bit string field
CREATE TABLE test (a BIT(8));
When I get the type of this filed from Java
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("SELECT a FROM
test");
ResultSetMetaData rsmd = rs.getMetaData();
int type = rsmd.getColumnType(1);
String name = rsmd.getColumnTypeName(1);
I get
type=-7 that is equal to java.sql.Types.BIT
name=bit
Now I'd like to set the field in a PreparedStatement
PreparedStatement update =
connection.prepareStatement("UPDATE test SET a=?");
update.setObject(1, "B10101010", java.sql.Types.BIT);
update.executeUpdate();
and I get
org.postgresql.util.PSQLException: ERROR: column "a"
is of type bit but expression is of type boolean
How can I set bit string field in PreparedStatement?
Thanks.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
В списке pgsql-jdbc по дате отправления