Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Informix > Running Established Stored Procedures from Java

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-19-03, 18:44
ksavage ksavage is offline
Registered User
 
Join Date: May 2003
Posts: 2
Running Established Stored Procedures from Java

Hi, I am trying to run a stored procedure from a Java API. I am able to connect and kick off the procedure, but when the procedure hits the code:
Let stringdate = Today;

The Today command returns the date in the following format:
yyyy-mm-dd.

However, when the stored procedure is run from DBACCESS or from a PowerBuilder GUI, that line of code returns the date in the following format:
mm/dd/yyyy

The rest of the code in the procedure works on the assumption that the date string is in mm/dd/yyyy format and therefore errors when run from Java.

My Question: Is there something in the connection from Java that I need to set, to 'tell' informix the expected date format?

Note: Java is using yyyy-mm-dd as its default date format(and I don't know if that is changable. I am using Informix 7.3 and informix native JDBC driver.
Thanks in advance,
Karen
Reply With Quote
  #2 (permalink)  
Old 05-20-03, 03:26
eherber eherber is offline
Registered User
 
Join Date: Aug 2002
Location: Bonn/Germany
Posts: 152
You can use the 'to_char()' function to format
the date.

let string_date = to_date(today, '%m/%d/%y');
__________________

Best regards

Eric
--
IT-Consulting Herber
WWW: http://www.herber-consulting.de
Email: eric@herber-consulting.de

***********************************************
Download the IFMX Database-Monitor for free at:
http://www.herber-consulting.de/BusyBee
***********************************************
Reply With Quote
  #3 (permalink)  
Old 05-20-03, 14:39
ksavage ksavage is offline
Registered User
 
Join Date: May 2003
Posts: 2
[>>You can use the 'to_char()' function to format the date.
>>let string_date = to_date(today, '%m/%d/%y'); [/size][/quote]

Thanks for your response, but I think you are missing my point.

This stored procedure and many others are being used by other applications. Therefore, I cannot go in and change them.

What I am trying to do is force Informix to use the mm/dd/yyyy format regardless of what application calls the stored procedure.

I know I can manipulate DBDATE from Unix and dbaccess will reflect the format specified, however when I connect from Java, it reverts back to Java's default format. One solution could be to set DBDATE from within a stored procedure, so that all other procedures called from that thread will be affected. However, I am not aware of such a method in Informix Stored procedure Language.

Are you familiar with any thing that might get me where I need to go?

Karen
Reply With Quote
  #4 (permalink)  
Old 05-22-03, 03:09
eherber eherber is offline
Registered User
 
Join Date: Aug 2002
Location: Bonn/Germany
Posts: 152
You can't set DBDATE in stored procedures.
Stored procedures use the DBDATE setting of the
databaseserver (the value of DBDATE in the environment
where the databaseserver was started) when they are created
or re-optimized

I don't understand your question.
Use the to_char() conversion routine in your stored procedure
and you could be sure that the date-format is always the
same in your stored procedure regardless if it is called
from java or dbaccess or any other tools.
__________________

Best regards

Eric
--
IT-Consulting Herber
WWW: http://www.herber-consulting.de
Email: eric@herber-consulting.de

***********************************************
Download the IFMX Database-Monitor for free at:
http://www.herber-consulting.de/BusyBee
***********************************************
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On