BOXI - Invalid month in date

BOXI - Invalid month in date

Posted By: pmietlicki

Published to Business Objects on Mar 26, 2017

Default dates under informix use the "american" convention (MM/DD/YYYY) which can be a source of problems for international users, especially when they make "free hand SQL" and use DD/MM/YYYY dates .

To change this behaviour, you will have to edit (with notepad or notepad++) some config files named informix.prm that are, for BOXI3, inside C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\dataAccess\connectionServer\informix and C:\Program Files\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\dataAccess\connectionServer\jdbc in order to change the config with :

'DD/MM/YYYY'

Under BOXI4, search *.prm files, paths are slightly differents (contain SAP BusinessObjects).

You will also have to change registry keys with regedit or with informix tool Setnet32 :

[HKEY_LOCAL_MACHINE\SOFTWARE\Informix\Environment]
"INFORMIXDIR"="C:\\Program Files\\Informix\\Client-SDK\\"
"DELIMIDENT"="n"
"DBDATE"="DMY4/"

If these tasks are not done, you will have the error « Invalid month in date ».

For BOXI3, I have made a script (comments are in french) : dates_informix.zip. To use it, just, just extract 2 files “correctif_dates_informix.vbs” and “informix.reg” inside the same folder. Then right click on “correctif_dates_informix.vbs” and “Open”.

Source file (that you will have to adapt if you want it to work with BOXI4 because paths are differents) :

num = GetAddRemove 
If num<0 Then
MsgBox "Aucun produit client BOXIR3 installe."
Else
'On ecrase les parametres du client Informix
Return = WScript.CreateObject("WScript.Shell").Run("regedit.exe /s informix.reg", 10, true)
'Dans tous les cas on remplace les parametres de informix.prm
Set oShell = CreateObject("WScript.Shell")
Set oProcEnv = oShell.Environment("PROCESS")
sProgramFiles = oProcEnv("ProgramFiles")
If sProgramFiles = "" Then
sProgramFiles = oShell.RegRead _
("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir")
End If
Remplacement sProgramFiles & "\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\dataAccess\connectionServer\jdbc\informix.prm"
Remplacement sProgramFiles & "\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\dataAccess\connectionServer\informix\informix.prm"
End If
Function GetAddRemove
'Renvoie 0 si juste le client installe (sans SP2 ni fixpack)
'Renvoie 1 si SP2 installe
'Renvoie 2 si FP installe
'Les variables
Dim cnt, oReg, sBaseKey, iRC, aSubKeys
'Les clefs de la base de registre a regarder
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
"localhost" & "/root/default:StdRegProv")
sBaseKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
iRC = oReg.EnumKey(HKLM, sBaseKey, aSubKeys)
Dim sKey, sValue, sVersion, sDateValue, sYr, sMth, sDay
Dim numRet, numTmp
numRet = -10
For Each sKey In aSubKeys
iRC = oReg.GetStringValue(HKLM, sBaseKey & sKey, "DisplayName", sValue)
If iRC <> 0 Then
oReg.GetStringValue HKLM, sBaseKey & sKey, "QuietDisplayName", sValue
End If
If (sValue <> "") AND (InStr(sValue, "BusinessObjects Enterprise XI 3.1 Client Tools")) Then
numTmp = 0
If InStr(sValue, "SP2") Then
numTmp = 1
End If
If InStr(sValue, "FP 2.6") Then
numTmp = 2
End if
If numTmp > numRet Then
numRet = numTmp
End if
cnt = cnt + 1
End If
Next
GetAddRemove = numRet
End Function

Sub Remplacement(FileName)
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(FileName, ForReading)
strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, "MM/DD/YYYY", "DD/MM/YYYY")
Set objFile = objFSO.OpenTextFile(FileName, ForWriting)
objFile.WriteLine strNewText
objFile.Close
End Sub

Tags: BO, BOXI3, vbs

Archive