473,749 Members | 2,665 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DB2 date format issue

Hi all,
we have the following urgent issue affecting our development team.
Initially we had one particular workstation that failed executing
queries on a DB2 database, raising an invalid date format exception
(SQLSTATE=22007 ). The same queries worked fine on all the other
workstations. The date format we want to use is "dd/mm/yyyy".After
reinstalling several times the db2 runtime client w/ different
options, we found on a technical forum the following instructions that
seemed to solve our problem:

db2 bind @d2ubind.lst datetime ISO
db2 bind @d2cli.lst datetime ISO

We tried to launch the commands from the non-working workstation, but
as a result now the malfunction (i.e. SQLSTATE=22007) now affects also
all the other workstations.
What can be happened?
Is there a sort of "roll back" on those commands, so that the
preceding configuration can be restored?
Any help will be greatly appreciated.
Thanks.
Nov 12 '05 #1
6 31183

"Dario Di Bella" <da************ @libero.it> wrote in message
news:63******** *************** ***@posting.goo gle.com...
Hi all,
we have the following urgent issue affecting our development team.
Initially we had one particular workstation that failed executing
queries on a DB2 database, raising an invalid date format exception
(SQLSTATE=22007 ). The same queries worked fine on all the other
workstations. The date format we want to use is "dd/mm/yyyy".After
reinstalling several times the db2 runtime client w/ different
options, we found on a technical forum the following instructions that
seemed to solve our problem:

db2 bind @d2ubind.lst datetime ISO
db2 bind @d2cli.lst datetime ISO

We tried to launch the commands from the non-working workstation, but
as a result now the malfunction (i.e. SQLSTATE=22007) now affects also
all the other workstations.
What can be happened?
Is there a sort of "roll back" on those commands, so that the
preceding configuration can be restored?
Any help will be greatly appreciated.
Thanks.


Without looking at the manual to verify this, I would try:
db2 bind @d2ubind.lst datetime USA
db2 bind @d2cli.lst datetime USA
Nov 12 '05 #2

"Dario Di Bella" <da************ @libero.it> wrote in message
news:63******** *************** ***@posting.goo gle.com...
Hi all,
we have the following urgent issue affecting our development team.
Initially we had one particular workstation that failed executing
queries on a DB2 database, raising an invalid date format exception
(SQLSTATE=22007 ). The same queries worked fine on all the other
workstations. The date format we want to use is "dd/mm/yyyy".After
reinstalling several times the db2 runtime client w/ different
options, we found on a technical forum the following instructions that
seemed to solve our problem:

db2 bind @d2ubind.lst datetime ISO
db2 bind @d2cli.lst datetime ISO

We tried to launch the commands from the non-working workstation, but
as a result now the malfunction (i.e. SQLSTATE=22007) now affects also
all the other workstations.
What can be happened?
Is there a sort of "roll back" on those commands, so that the
preceding configuration can be restored?
Any help will be greatly appreciated.


The format you specified, 'dd/mm/yyyy', is *not* ISO format. ISO format is
'yyyy-mm-dd'. In fact, your format, 'dd/mm/yyyy' is not one of the
"standard" formats (ISO, JIS, EUR) at all, although it is *similar* to the
EUR format ('dd.mm.yyyy'). If you want to use a non-standard format like
'dd/mm/yyyy', I believe you need to use DATETIME LOC or DATETIME DEF in the
bind commands that you issued, not DATETIME ISO. However, if you want to use
DATETIME LOC or DATETIME DEF, I believe you have to write your own datetime
exit program and plug it into DB2. This program would have two jobs:
1. store any incoming date, which would be in 'dd/mm/yyyy' format, in
yyyymmdd format, which is the internal format used for all DB2 dates.
2. reformat any stored date, which would be in yyyymmdd format, and return
it in 'dd/mm/yyyy' format.

In the past, these exit programs had to be written in Assembler (at least on
the mainframe) but I'm not sure if this is the case for DB2 on
Windows/Unix/Linux. Unfortunately, I haven't been able to find information
about the coding of these exits in the manuals. With any luck you could
simply write a user-defined function in a higher level language like Java or
C to do this for you.

If you really want to go to that effort, feel free. You might find it easier
to use the standard EUR format, 'dd.mm.yyyy', in which case you would
probably end your errors by doing the two BIND commands again, this time
with DATETIME EUR. That should get your programs and queries working again
immediately and give you time to decide if you want to change over to
DATETIME LOC later.

IMPORTANT: I should warn you that the advice I've just given you may not
work and may even make your situation worse. It seems possible that there is
a codepage issue here but I'm not very experienced with codepage problems. I
have no experience at all with the interactions of date exit programs with
code pages, assuming you decide to write such a program. Therefore, what I'm
advising *could* make things worse. I strongly advise you to research this
issue carefully before acting if you want to be absolutely sure that you
don't make the problem worse.

Rhino
Nov 12 '05 #3
Rhino,
thanks for your advice, but something is still unclear.
In the original situation all the workstations worked properly using
the 'dd/mm/yyyy' date format. Only one workstation failed, reporting
the date format exception. Hence what can we desume about the datetime
settings in the original situation? Is there a way to restore such
settings?
An IBM support site states about the datetime setting:

'[...]If not specified, it defaults based on the country/region code.'

I think that this should be the original setting, and the failure of a
single workstation can be explained as a result of bad country/region
settings on that specific client.
Is that possible? If so, how can I 'unset' the datetime code?

Thanks.

dario.
The format you specified, 'dd/mm/yyyy', is *not* ISO format. ISO format is
'yyyy-mm-dd'. In fact, your format, 'dd/mm/yyyy' is not one of the
"standard" formats (ISO, JIS, EUR) at all, although it is *similar* to the
EUR format ('dd.mm.yyyy'). If you want to use a non-standard format like
'dd/mm/yyyy', I believe you need to use DATETIME LOC or DATETIME DEF in the
bind commands that you issued, not DATETIME ISO. However, if you want to use
DATETIME LOC or DATETIME DEF, I believe you have to write your own datetime
exit program and plug it into DB2. This program would have two jobs:
1. store any incoming date, which would be in 'dd/mm/yyyy' format, in
yyyymmdd format, which is the internal format used for all DB2 dates.
2. reformat any stored date, which would be in yyyymmdd format, and return
it in 'dd/mm/yyyy' format.

In the past, these exit programs had to be written in Assembler (at least on
the mainframe) but I'm not sure if this is the case for DB2 on
Windows/Unix/Linux. Unfortunately, I haven't been able to find information
about the coding of these exits in the manuals. With any luck you could
simply write a user-defined function in a higher level language like Java or
C to do this for you.

If you really want to go to that effort, feel free. You might find it easier
to use the standard EUR format, 'dd.mm.yyyy', in which case you would
probably end your errors by doing the two BIND commands again, this time
with DATETIME EUR. That should get your programs and queries working again
immediately and give you time to decide if you want to change over to
DATETIME LOC later.

IMPORTANT: I should warn you that the advice I've just given you may not
work and may even make your situation worse. It seems possible that there is
a codepage issue here but I'm not very experienced with codepage problems. I
have no experience at all with the interactions of date exit programs with
code pages, assuming you decide to write such a program. Therefore, what I'm
advising *could* make things worse. I strongly advise you to research this
issue carefully before acting if you want to be absolutely sure that you
don't make the problem worse.

Rhino

Nov 12 '05 #4
Mark,

I guess that USA datetime format is 'mm/dd/yyyy', while our desired
format is 'dd/mm/yyyy'. Correct?

Thanks.

Dario.
Nov 12 '05 #5
Dario,

You raise an excellent question. The truth is, I don't know why your other
workstations were working at one point. I don't know enough about your
configurations and settings to be able to explain it to you. In fact, you
haven't even said which version of DB2 you are using or what platform you
have. I assumed you were using DB2 V7 or V8 for Windows/Unix/Linux - and
should have said so in my post. Perhaps if you can tell us your DB2 version
and platform, we can figure out exactly why your workstations were behaving
differently. Perhaps the workstation that failed was using a different
codepage or language setting than the others.

As far as I know, there is no way to "rollback" the commands that set the
DATETIME format; you have to change the desired datetime format via the bind
commands that you used, at least in DB2 V7 for Windows/Unix/Linux. If you
are on DB2 for z/OS or AS/400, or have an earlier or later version of DB2,
the solution may be different.

We really need to know which version of DB2 you are using, which platform
you are using, and which DB2 product (Workgroup Edition, EE? EEE?) you are
using first to be sure that we are looking in the right manuals to solve
your problem.

I suggested rebinding with DATETIME EUR because you said your situation was
urgent. It could solve your problem quickly, except that there are some
risks. It is safer to diagnose your problem more thoroughly but it will take
a little longer....

Rhino

"Dario Di Bella" <da************ @libero.it> wrote in message
news:63******** *************** ***@posting.goo gle.com...
Rhino,
thanks for your advice, but something is still unclear.
In the original situation all the workstations worked properly using
the 'dd/mm/yyyy' date format. Only one workstation failed, reporting
the date format exception. Hence what can we desume about the datetime
settings in the original situation? Is there a way to restore such
settings?
An IBM support site states about the datetime setting:

'[...]If not specified, it defaults based on the country/region code.'

I think that this should be the original setting, and the failure of a
single workstation can be explained as a result of bad country/region
settings on that specific client.
Is that possible? If so, how can I 'unset' the datetime code?

Thanks.

dario.
The format you specified, 'dd/mm/yyyy', is *not* ISO format. ISO format is 'yyyy-mm-dd'. In fact, your format, 'dd/mm/yyyy' is not one of the
"standard" formats (ISO, JIS, EUR) at all, although it is *similar* to the EUR format ('dd.mm.yyyy'). If you want to use a non-standard format like
'dd/mm/yyyy', I believe you need to use DATETIME LOC or DATETIME DEF in the bind commands that you issued, not DATETIME ISO. However, if you want to use DATETIME LOC or DATETIME DEF, I believe you have to write your own datetime exit program and plug it into DB2. This program would have two jobs:
1. store any incoming date, which would be in 'dd/mm/yyyy' format, in
yyyymmdd format, which is the internal format used for all DB2 dates.
2. reformat any stored date, which would be in yyyymmdd format, and return it in 'dd/mm/yyyy' format.

In the past, these exit programs had to be written in Assembler (at least on the mainframe) but I'm not sure if this is the case for DB2 on
Windows/Unix/Linux. Unfortunately, I haven't been able to find information about the coding of these exits in the manuals. With any luck you could
simply write a user-defined function in a higher level language like Java or C to do this for you.

If you really want to go to that effort, feel free. You might find it easier to use the standard EUR format, 'dd.mm.yyyy', in which case you would
probably end your errors by doing the two BIND commands again, this time
with DATETIME EUR. That should get your programs and queries working again immediately and give you time to decide if you want to change over to
DATETIME LOC later.

IMPORTANT: I should warn you that the advice I've just given you may not
work and may even make your situation worse. It seems possible that there is a codepage issue here but I'm not very experienced with codepage problems. I have no experience at all with the interactions of date exit programs with code pages, assuming you decide to write such a program. Therefore, what I'm advising *could* make things worse. I strongly advise you to research this issue carefully before acting if you want to be absolutely sure that you
don't make the problem worse.

Rhino

Nov 12 '05 #6
Dario,

As a followup to my previous posts, I've done some further research and
found an article on how to set up a custom date format so that you can have
'dd/mm/yyyy', instead of 'dd.mm.yyyy'.

CAUTION: The article is written for DB2 for Windows/Unix/Linux so the
techniques may not be applicable is you are using DB2 on a different
platform! If you are using a different platform, I will try to find similar
information for your platform.

Here is the URL:
http://www-106.ibm.com/developerwork.../0211yip3.html

As you will see, the article contains information on how to change the date
format and how to write a custom date/time UDF so that you can have a format
like 'dd/mm/yyyy'. Of course, you will not be able to use the UDF shown in
the example *exactly* as shown; you will have to modify it for your format.
But the example is a good basis for your own program. All you have to do is
modify this example for your format, then install it just like you would any
other UDF. This shouldn't take more than an hour or two if you have some
developers familiar with writing UDFs.

However, this isn't the ideal solution yet: the best solution would be for
all dates to display as 'dd/mm/yyyy' *without* having to convert them via a
UDF. I will do more research to see how that can be done. This is an
interesting problem and I'm curious to know the answer myself.

Rhino
Nov 12 '05 #7

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

Similar topics

10
1895
by: Jack | last post by:
Hi, I cannot get the date format correctly in dynamic sql statement, after trying various ways of handling it. I need some help with the date format in the following dynamic sql statement. Any help is appreciated in advance. While running the asp page, I still get an error as Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch: 'Format' DYNAMIC SQL STATEMENT:
4
3451
by: peashoe | last post by:
I have an asp page that uses a calendar.js (pop-up) file to add an exact date format in the text field (txtDDate). My problem is I need some javascript that sets an alert that does not allow them to select today. example: var dtToday = Date() if(document.frmSoftware.txtDDate.value == dtToday) { alert("You cannot select same day distributions. Please enter a new
6
2763
by: kevin carter | last post by:
hi i have a table conataining several fields one of which is date i want to be able to search the table on the date field using code. the code below generates the query from a form, however i get an error message "Run time Error 2001" when this code is run. Can anyone please tell me where i have gone wrong or how to stop this error message Dim db As DAO.Database Dim qdf As DAO.QueryDef
7
2770
by: mr.nimz | last post by:
hello, this is antenio. recently i've come to a problem. i got a way through it, somehow, still it left me in a curious state, so i'm posting it here, if i can get an answer from some techy, here is my table structure, Name: Table1
16
11909
by: Mik | last post by:
I apologise if this post seems a little basic, but I am a newbie and have NO access knowledge. I have downloaded the Accounts Ledger from the Microsoft Website. It allows the user to review a report of transactions between a Start & End date. The Tables and forms i believe are UK format "dd/mm/yyyy", However, when I click on "Review Reports" and enter the date as UK "dd/mm/yyyy", it returns nothing.
21
3384
by: Darin | last post by:
I have an applicatoin that works 100% perfect when running on a machine setup for English (United States), but when I change it to Spanish (Mexico), the dates start giving me fits. THe reason is USA is mm/dd/yyyy and mexico is dd/mm/yyyy. So, with the computer set to mexico, any standard CDATE function is going to return the date in the dd/mm/yyyy setting since that is what the computer is set to. I want to be able to enter a date in...
2
16804
by: thewilldog | last post by:
Hello, I've reviewed the archives here to address the issue, but I'm still running into problems. I've got a table field populated with the record date in text "YYYYMMDD" To convert it into a recognizable date format, I've done the following: Query 1: References Source Table; Isolates Year, Day; creates MMDD field Acc Open Year: Left(,4) Acc Open Day: Right(,2) MMDD: Right(,4) Query 2: References Query 1; Isolates Month
10
5820
by: ARC | last post by:
Hello all, General question for back-end database that has numerous date fields where the database will be used in regions that put the month first, and regions that do not. Should I save a date format in the table design, such as: mm/dd/yyyy? What I've done for years is to store the date format in date fields, then on the forms, based on their region, I would set the date formats on form_load
9
1688
by: TC | last post by:
Hi. I have some ASP written in VB.net which is currently installed on a customers server. The asp connects to a local MySql database and retrieves data for the customers customers. If you see what I mean. The problem is their server insists on showing dates in the US format. The server has no other language installed than UK and all settings I can find are UK.
0
8833
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,...
1
9335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
tracyyun
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...
0
8257
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6801
isladogs
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...
0
4709
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...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3320
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
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.