473,322 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

db2 jdbc

hi all,
how do I insert "VARCHAR FOR BIT DATA" via jdbc?
I like to create from an ResaultSet (from a table) Insert-Statements.

How do I hanlde the Field-Types?
Does someone have an example in java?

Thank you very much....

May 10 '06 #1
5 1899
in**@daten-host.de wrote:
hi all,
how do I insert "VARCHAR FOR BIT DATA" via jdbc?
I like to create from an ResaultSet (from a table) Insert-Statements.


You can use the "setBinaryStream" method of the PreparedStatement
class/interface or the "setBytes" method. Alternatively, convert the
binary data to its hex representation and use:

x'...'

in the SQL statement where the ... is the string with the hex
representation.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
May 10 '06 #2
Thank you Knut,
do you have an small example?

May 10 '06 #3
.... and what is the difference between CAHR FOR BIT DATA and VARCAHR
For BIT DATA.
(is there a difference in the insert?)

May 10 '06 #4
in**@daten-host.de wrote:
... and what is the difference between CAHR FOR BIT DATA and VARCAHR
For BIT DATA.
(is there a difference in the insert?)


Well, the same difference as with CHAR and VARCHAR: one has a fixed length
and the other a flexible length. If the stream that you provide to DB2 for
a CHAR FBD column is too short, it will be padded with spaces, i.e. with
trailing x'20' bytes.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
May 10 '06 #5
a new question to that topic:
could I insert the hex-string with PreparedStatements ?

Knut Stolze wrote:
in**@daten-host.de wrote:
... and what is the difference between CAHR FOR BIT DATA and VARCAHR
For BIT DATA.
(is there a difference in the insert?)


Well, the same difference as with CHAR and VARCHAR: one has a fixed length
and the other a flexible length. If the stream that you provide to DB2 for
a CHAR FBD column is too short, it will be padded with spaces, i.e. with
trailing x'20' bytes.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany


Jun 2 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: JShurmatz | last post by:
If anyone can shed some light on this problem I would greatly appreciate it. I am unsuccessfully trying to use a database connnection retrieved from a pool configured using Java System Web...
0
by: Nils Valentin | last post by:
Hi MySQL Fans ;-), Is it possible that the 3.08 series allows to connect to 4.0.14 versions but not to the 4.1 alpha-versions ? I get belows error when tryig to connect from DbVisualizer which...
0
by: Robert Mazur | last post by:
MySQL 5.0 alpha (binary install) on Solaris 9 -or- RedHat 8.0 mysql-connector-java-3.0.8-stable ----------------------- Is there something different going on with JDBC and the alpha version...
0
by: Bing | last post by:
Hi, I am configuring the same DB2 v8.1 JDBC universal driver (db2jcc.jar and db2jcc_license_cisuz.jar) from DB2 SP5 fix pack under WSAD 5.1.x environment and WebSphere application Server 5.0.2...
0
by: Raquel | last post by:
UDB PE 8.1 on Win XP. Per the manual: DB2 JDBC traces always begin with a header that lists important system information such as key environment variable settings, the JDK or JRE level, the...
1
by: Praveen | last post by:
Hi, I have installed WebSphere Portal on AIX and connected to DB2 on a remote machine, Getting the followin errors when trying to get the values from database thru applications installed on...
1
by: rpm45tech | last post by:
Hi everyone. I'm deveolping in Java with DB2 running on Win XP and everything was working ok but then I installed Vista Ultimate and the application stopped working. This is the exception showed: ...
2
by: bevis | last post by:
I'm new to sql server and mysql but this seems like it should be a pretty straight forward jdbc connection. But I have spent almost 2 days just trying to get a jdbc connection. Please help if you...
3
by: Anoop | last post by:
Is it true that there are no type 4 jdbc drivers to connect to a DB2 server v7.1? The DB2 server is hosted on ACF2 (OS/390). We would be connecting from windows and solaris boxes. If it is true,...
0
by: Jim Kennedy | last post by:
ALL DDL does a commit. Hence Drop Table movies; issues a commit. True you don't issue a commit and the driver does not issue a commit, but the server does for all DDL. That is probably where...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.