Results 1 to 4 of 4
  1. #1
    Join Date
    May 2003
    Posts
    2

    Unanswered: 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

  2. #2
    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
    ***********************************************

  3. #3
    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

  4. #4
    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
    ***********************************************

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •