|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
JDBC Adapter - Date Issue |
« View previous topic :: View next topic » |
Author |
Message
|
vk |
Posted: Tue Oct 04, 2005 8:24 pm Post subject: JDBC Adapter - Date Issue |
|
|
Partisan
Joined: 20 Sep 2005 Posts: 302 Location: Houston
|
Hi,
Using JDBC adapter, is it possible to read records from tables having Date field as keys?
I am using JDBC adapter to read from DB2 database and send the records as XML messages to the broker. The application table has a primary key formed by a combination of columns of which one is of Date type. The date format is YYYY-MM-DD.
I read that in the BO, the attribute TS has to be set to false in the 'Application Specific Information' for fields of data type Date. Only then the adapter will treat it as a Date. Otherwise the default for attribute TS is true and the adapter treats it as a Timestamp. If I dont set the TS attribute, I get the error 'Unparseable Date'. If I set TS to false, I am getting the error - 'A field with TS attribute set cannot be primary or foreign key'. I tried giving the value for date in the Object Key field for the event table in date and timestamp formats - YYYY-MM-DD, YYYY-MM-DD HH:MM:SS. Both throw the unparseable date error.
If I define the column as DateTime in the table, I am able to define it as a key field in the BO and the adapter retrieves records from the table without any problems. If the date field is not a key, then also everyhting works fine.
Is there a way to get over the error when Date field is a key? Any pointers would be welcome.
Thanks,
VK. |
|
Back to top |
|
 |
RocknRambo |
Posted: Thu Oct 06, 2005 7:39 am Post subject: |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
In the connectorspecific properties of ur .cfg file, what did u specify in the DateFormat Field ?
-RR |
|
Back to top |
|
 |
vk |
Posted: Thu Oct 06, 2005 9:20 am Post subject: JDBC Adapter - Date Issue |
|
|
Partisan
Joined: 20 Sep 2005 Posts: 302 Location: Houston
|
Hi,
In the configuration file, I gave the date format as YYYY-MM-DD. But does this matter? Isn't this the format in which the adapter sends date fields to the broker and expects date value to come from the broker.
If in the table, the date field is not a key, the adapter reads the date value and converts it to whatever format I specify in the Configuration file and send it to the broker. Request processing also works fine as long as I am putting the date in the format specified in the cfg file to the Request Queue.
My issue is in reading from tables, where date field is the key. The adapter throws the error - Unparseable date. I am not sure, if it has something to do with the format in which I enter the date value in the Object_Key field of the event table.
Hope whatever I said is clear.
Thanks,
VK. |
|
Back to top |
|
 |
vk |
Posted: Sun Oct 09, 2005 11:17 am Post subject: JDBC Adapter - Date Issue |
|
|
Partisan
Joined: 20 Sep 2005 Posts: 302 Location: Houston
|
Hi,
I tried running 3 cases with respect to this date issue -
Case 1: Date field is not a key in database and BO
Date Format in config file for connector is YYYY-MM-DD
Result: BO is retrieved from the table and sent to the broker in the above date format for the date field.
Case 2: Date field is a key in database and BO
Date format in config file is YYYY-MM-DD
Object Key in Event Table has date of format YYYY-MM-DD
Result: BO Retrieval fails with SQL error code 07006
Case 3: Field is of type Timestamp in databse and BO
Date Format in config file is YYYY-MM-DD HH:mm:ss
Object Key in Event Table has date of format YYYY-MM-DD HH:mm:ss
Result: BO is retieved from the table and sent to the broker in the above date format for the date field.
Is there a way to make Case 2 work? In the BO, both Date and Timestamp have to be defined as Date. For Date fields, the attribute TS should be set to false in the application specific information. But when I set this, I get the error - An attribute of Type TS cannot be a key field.
VK. |
|
Back to top |
|
 |
punugupati |
Posted: Sun Oct 09, 2005 3:28 pm Post subject: |
|
|
Newbie
Joined: 06 Oct 2005 Posts: 1 Location: Melbourne
|
By default JDBC Adaptor uses in the configuration format. I will suggest you write a custom java code in the date mapping field (convert db format and set value to destination variable).
cheers
guru |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|