I am trying to use the PreparedStateme nt's addBatch to load data in an
ETL-like process into a table. There is a single prepared statement.
The parameters are set on it and prepStmt.addBat ch() is called. Then
the next iteration of setting the params and adding to batch begins.
Finally after setting the batch of 2 to 2000 rows, the
prepStmt.execut eBatch() is called.
If the last row contains a null value for a particular DECIMAL field,
then the value for that field in all the rows is stored truncated to
their integer value in the table. Tried using different methods of
setting the null - setNull, setObject, setBigDecimal etc, but still the
value is truncated. If the DECIMAL fields in the last row are not null,
then this truncation does not happen. Note that it only happens for
those DECIMAL columns, that have a null value in the last row.
E.g.:
statement:
INSERT INTO PAY (EMP_ID, AMT_PAID) VALUES (?, ?);EMP_ID is INTEGER
AMT_PAID is DECIMAL(12,4)
If the parameters were set as follows, in the same order:
EMP_ID, AMT_PAID
----------------
1001, 3414.5512
1002, null
1003, 3151.6633
Then there is no truncation.
But if the parameters were set in this order:
EMP_ID, AMT_PAID
----------------
1001, 3414.55
121003, 3151.6633
1002, null
Then, the values of AMT_PAID get truncated in all rows. i.e. in DB, it
appears as:
EMP_ID, AMT_PAID
----------------
1001, 3414.0000
1003, 3151.0000
1002, null
All decimal values are stored using setBigDecimal. Integer values are
stored using setInt. All methods of setting the null were tried -
setNull, setObject, setBigDecimal etc. but with same error. I debugged,
and found that until the executeBatch is called, the value contained in
PS is proper, but the value appears truncated in DB. :(
Is there something wrong being done? Is this a known issue? Any
workarounds or patches?
The JDBC driver files are from the db2_jdbc_t4.zip available from IBM's
website. DB2 version: DB2/6000 8.1.6.
Thanks,
Gopal 0 1738 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John Bentley |
last post by:
John Bentley:
INTRO
The phrase "decimal number" within a programming context is ambiguous. It could
refer to the decimal datatype or the related but separate concept of a generic
decimal number. "Decimal Number" sometimes serves to distinguish Base 10
numbers, eg "15", from Base 2 numbers, Eg "1111". At other times "Decimal
Number" serves to differentiate a number from an integer. For the rest of this
post I shall only use either...
|
by: Dani |
last post by:
Hi everyone
Description of the problem:
Using a PreparedStatement to write down an integer (int) plus a
timestamp for testing purposes. When read out again the integer looks
very different. We found that it was shifted three Bytes to the left,
i.e. 4 becomes hex 4000000 which is 67108864 in decimal base. This
means that the value written and the value read sometimes do not
match, which is of course inacceptable for all real world...
|
by: usenet |
last post by:
Hi.
I have a DB2 stored procedure that I call using JDBC. Now I'm trying to
batch the call. This is done by the book:
stmt = connection.prepareCall(" ... ");
stmt.setString(1, "foo");
stmt.addBatch();
|
by: L Mehl |
last post by:
Hello --
Goal is to export data from tblData having this structure:
dateRecord Date/Time
textFrom Text 4
textTo Text 4
valueRecord Number Double (format = Standard, Dec Pl = 12)
Using the following code
|
by: Jerry |
last post by:
I managed to narrow this down to a very simple expression. try this:
private void Bug()
{
bool b = false;
Test(3, (b || b) && b && !b);
}
private void Works()
{
| |
by: balleyman47 |
last post by:
getting the following error when executing an insert statement:
java.lang.IllegalArgumentException: Date/Time must be JDBC format
running on UDB 8.2 fix pack 10 using IBM type IV driver.
Query in JAVA program works successfully in old environment, converting
from UDB 7 to above UDB version.
Values passed during execution of insert statement (inserting into
table A) are derived from date fields on another table B but will
|
by: Diego |
last post by:
Hi everybody!
I'm using DB2 PE v8.2.3 for linux. I've defined a database with the
following schema:
ANNOTATION(ID,AUTHOR,TEXT)
ANNOTATION_BOOK(ANNOTATION_ID,OBJECT_ID)
BOOK(ID,AUTHOR,TITLE).
Between the book and annotation entities there is a many-to-many
|
by: Joe Weinstein |
last post by:
Hi. Below is a simple JDBC program to insert and extract
a numerical value. When ResultSet.getDouble() is called,
the same program produces different output on solaris
than it does on Linux. I would be grateful for any
discussion of this!
thanks,
Joe Weinstein at BEA Systems
Results on Linux Box
-----------------------------------------------------------------------
|
by: bunty.gopal |
last post by:
This is the solution to the issue in the subject, question itself was
posted in a previous thread long back.
Use the latest DB2 db2cc.jar fixpack on the client, or add
"deferPrepares=false" to the connection string when opening the
connection (or connection pool properties, if deployed on a server like
weblogic). The issue can be resolved using either of these options.
Gopal
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |