Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Passing date parameters to a java-method

3 posts in General Discussion Last posting was on 2008-06-20 16:55:00.0Z
Bert Belaen Posted on 2008-05-23 10:11:09.0Z
Sender: 1221.483695b1.1804289383@sybase.com
From: Bert Belaen
Newsgroups: ianywhere.public.general
Subject: Passing date parameters to a java-method
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4836983d.1285.1681692777@sybase.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="-=_forums-1-dub4836983d"
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 23 May 2008 03:11:09 -0700
X-Trace: forums-1-dub 1211537469 10.22.241.41 (23 May 2008 03:11:09 -0700)
X-Original-Trace: 23 May 2008 03:11:09 -0700, 10.22.241.41
Lines: 65
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6854
Article PK: 5089

We're testing SqlAnywhere 10. We want to upgrade from
version 7.
We've implemented a lot of functionality in Java in the
database.
Now I've encountered a problem when i want to pass a date to
a java-method. I created a little test-class, for the
source-code, see the attachment. We compiled it with JDK
1.1.8, and uploaded it to the database. Then we created a
wrapper-function, see below :

create function fdb_getStringDate(in testDate date) returns
char(200) external name
'testJavaInSA10.getStringDate(Ljava/sql/Date;)Ljava/lang/String;
' language java;

The only thing this function do is accept a date-parameter,
and return the string-value. When we call this function we
receive a 'java.text;ParseException : Unparseable date
"2003-12-31"'
SQLCODE=-91, ODBC 3 STATE = "HY000"

Any suggestion or help is welcome.

import java.io.*;
import java.lang.*;


public class testJavaInSA10
{
public static String getHelloWorld()
{
return "Hello World";
}

public static String getStringDate(java.sql.Date dtDatum) throws Exception
{
try {
return dtDatum.toString();
} catch ( java.lang.Exception Exc ) {
throw Exc;
}
}

public static String getStringInteger(int testInt)
{
Integer myInt = new Integer(testInt);
return myInt.toString();
}

public static String getString(String testString)
{
return "***" + testString + "***";
}

public static void getProcString(String[] testString)
{
testString[0] = "***" + testString[0] + "***";
}

public static String testGetStringDate()
{
java.sql.Date dtDatum = java.sql.Date.valueOf("2003-12-31");
String result = "";
try {
result = getStringDate(dtDatum);
} catch (Exception Exc) {
}
return result;
}

public static void main(String [] args)
{
System.out.println(getHelloWorld());
System.out.println(testGetStringDate());
System.out.println(getStringInteger(123));
System.out.println(getString("ABCD"));
String[] arrString = new String[1];
arrString[0] = "XYZ";
getProcString(arrString);
System.out.println(arrString[0]);
}

}


"Nick Elson" < Posted on 2008-06-18 20:34:27.0Z
From: "Nick Elson" <@@@nick@@@.@@@elson@sybase@@@.@@@com@@@>
Newsgroups: ianywhere.public.general
References: <4836983d.1285.1681692777@sybase.com>
Subject: Re: Passing date parameters to a java-method
Lines: 32
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <48597153$1@forums-1-dub>
Date: 18 Jun 2008 13:34:27 -0700
X-Trace: forums-1-dub 1213821267 10.22.241.152 (18 Jun 2008 13:34:27 -0700)
X-Original-Trace: 18 Jun 2008 13:34:27 -0700, vip152.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6919
Article PK: 5145

This looks like a bug to me. The server console is showing
a stack trace where it seems to indicate it is trying to bind
to the result as a Java Data instead of a character datatype.

I will look into this more shortly.

<Bert Belaen> wrote in message news:4836983d.1285.1681692777@sybase.com...
> We're testing SqlAnywhere 10. We want to upgrade from
> version 7.
> We've implemented a lot of functionality in Java in the
> database.
> Now I've encountered a problem when i want to pass a date to
> a java-method. I created a little test-class, for the
> source-code, see the attachment. We compiled it with JDK
> 1.1.8, and uploaded it to the database. Then we created a
> wrapper-function, see below :
>
> create function fdb_getStringDate(in testDate date) returns
> char(200) external name
> 'testJavaInSA10.getStringDate(Ljava/sql/Date;)Ljava/lang/String;
> ' language java;
>
> The only thing this function do is accept a date-parameter,
> and return the string-value. When we call this function we
> receive a 'java.text;ParseException : Unparseable date
> "2003-12-31"'
> SQLCODE=-91, ODBC 3 STATE = "HY000"
>
> Any suggestion or help is welcome.
>


"Nick Elson" < Posted on 2008-06-20 16:55:00.0Z
From: "Nick Elson" <@@@nick@@@.@@@elson@sybase@@@.@@@com@@@>
Newsgroups: ianywhere.public.general
References: <4836983d.1285.1681692777@sybase.com> <48597153$1@forums-1-dub>
Subject: Re: Passing date parameters to a java-method
Lines: 39
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <485be0e4$1@forums-1-dub>
Date: 20 Jun 2008 09:55:00 -0700
X-Trace: forums-1-dub 1213980900 10.22.241.152 (20 Jun 2008 09:55:00 -0700)
X-Original-Trace: 20 Jun 2008 09:55:00 -0700, vip152.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6926
Article PK: 5152

This is being sent over to engineering to review. It appears
to be a problem in recognizing the return type from the
signature.

"Nick Elson" <@@@nick@@@.@@@elson@sybase@@@.@@@com@@@> wrote in message
news:48597153$1@forums-1-dub...
> This looks like a bug to me. The server console is showing
> a stack trace where it seems to indicate it is trying to bind
> to the result as a Java Data instead of a character datatype.
>
> I will look into this more shortly.
>
> <Bert Belaen> wrote in message news:4836983d.1285.1681692777@sybase.com...
>> We're testing SqlAnywhere 10. We want to upgrade from
>> version 7.
>> We've implemented a lot of functionality in Java in the
>> database.
>> Now I've encountered a problem when i want to pass a date to
>> a java-method. I created a little test-class, for the
>> source-code, see the attachment. We compiled it with JDK
>> 1.1.8, and uploaded it to the database. Then we created a
>> wrapper-function, see below :
>>
>> create function fdb_getStringDate(in testDate date) returns
>> char(200) external name
>> 'testJavaInSA10.getStringDate(Ljava/sql/Date;)Ljava/lang/String;
>> ' language java;
>>
>> The only thing this function do is accept a date-parameter,
>> and return the string-value. When we call this function we
>> receive a 'java.text;ParseException : Unparseable date
>> "2003-12-31"'
>> SQLCODE=-91, ODBC 3 STATE = "HY000"
>>
>> Any suggestion or help is welcome.
>>
>
>