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.

Sth. strange in Java in ASE

5 posts in General Discussion Last posting was on 2012-03-06 05:18:12.0Z
Eisen Posted on 2012-03-02 06:27:03.0Z
Sender: 46ea.4f50422b.1804289383@sybase.com
From: Eisen
Newsgroups: sybase.public.ase.general
Subject: Sth. strange in Java in ASE
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4f506837.50ed.1681692777@sybase.com>
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 1 Mar 2012 22:27:03 -0800
X-Trace: forums-1-dub 1330669623 172.20.134.41 (1 Mar 2012 22:27:03 -0800)
X-Original-Trace: 1 Mar 2012 22:27:03 -0800, 172.20.134.41
Lines: 117
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:30966
Article PK: 73855

Dear all
I'm new to Java in ASE, So I wrote a short java to have a
test --
package dbjava;
import com.sybase.jdbc3.jdbc.*;

public class AppTest implements Serializable
{

private static final long serialVersionUID = 1L;

public static void main(String[] args)
{
AppTest cibm = new AppTest("");
cibm.test();
}

public AppTest(String s)
{
m_content = s;
}

public String m_content = new String();

public void Append(String s,String delimeter)
{
m_content+=delimeter+s;
}

public void Show()
{
System.out.println(m_content);
}

public static void ShowProperty(String property)
{
System.out.println(System.getProperty(property));
}

}

I compiled and install it into a ASE15.0.3#4, then start my
test.
First I used a variable to test if Java inner method can
update the Java Object's member value--
1> declare @s dbjava.AppTest
2> select @s=new dbjava.AppTest('s1')
3> select @s>>Append("s2",',')
4> select @s>>Append("s3",',')
5> select @s>>Show()
6> go
(1 row affected)

---------------------------------------
dbjava.AppTest@455f455f

(1 row affected)

---------------------------------------
dbjava.AppTest@455f455f

(1 row affected)
s1,s2,s3

---------------------------------------
dbjava.AppTest@455f455f

(1 row affected)
It shows that the "select" can update the Java Object's
member value.
But when I tested with table, things come to be weird...

1> create table t(id int,s dbjava.AppTest)
2> go
1> insert t values(1,new dbjava.AppTest('s1'
2> insert t values(2,new dbjava.AppTest('t1'
3> go
(1 row affected)
(1 row affected)
1> select s>>Append("s2",",") from t
2> select s>>Append("s3",",") from t
3> go

-------------------------------------------
dbjava.AppTest@7f647f64
dbjava.AppTest@4690469

(2 rows affected)

-------------------------------------------
dbjava.AppTest@9590959
dbjava.AppTest@c110c11

(2 rows affected)
1> select s>>Show() from t
2> go
s1

-------------------------------------------
dbjava.AppTest@fed0fed
t1

-------------------------------------------
dbjava.AppTest@13ae13ae

(2 rows affected)
I think I'll get s1,s2,s3 and t1,s2,s3 but it's the original
value...
The method "Append" invoked by select has not update the
member value of the Java Object...
Is it right or not? Or my understanding to Java in ASE is
something wrong?
Please help to make it clear. Thanks in advance for your
help.

Best Regards
Eisen


J Posted on 2012-03-02 20:11:17.0Z
From: jtotally_bogus@sbcglobal.net (J)
Newsgroups: sybase.public.ase.general
Subject: Re: Sth. strange in Java in ASE
Reply-To: J@bogusemailAddress.com
Message-ID: <4f512897.681564156@forums.sybase.com>
References: <4f506837.50ed.1681692777@sybase.com>
X-Newsreader: Forte Free Agent 1.21/32.243
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 2 Mar 2012 12:11:17 -0800
X-Trace: forums-1-dub 1330719077 10.22.241.152 (2 Mar 2012 12:11:17 -0800)
X-Original-Trace: 2 Mar 2012 12:11:17 -0800, vip152.sybase.com
Lines: 157
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:30968
Article PK: 73859

On 1 Mar 2012 22:27:03 -0800, Eisen wrote:

If I understand correctly, you never updated the rows of t with the
"appended" values. You only selected them.

With just one row:

1> truncate table t
2> go
1> insert t values(1, new AppTest('s1'))
2> go
(1 row affected)
1> select s>>Show() from t
2> go
s1

--------------------------------------------------
AppTest@72ffb

(1 row affected)

1> select s>>Append("s2",",") from t
2> go

--------------------------------------------------
AppTest@1df38fd

(1 row affected)
1> select s>>Append("s2",",")>>Show() from t
2> go
s1,s2

--------------------------------------------------
AppTest@16a786

(1 row affected)

Jay

>Dear all
> I'm new to Java in ASE, So I wrote a short java to have a
>test --
>package dbjava;
>import com.sybase.jdbc3.jdbc.*;
>
>public class AppTest implements Serializable
>{
>
> private static final long serialVersionUID = 1L;
>
> public static void main(String[] args)
> {
> AppTest cibm = new AppTest("");
> cibm.test();
> }
>
> public AppTest(String s)
> {
> m_content = s;
> }
>
> public String m_content = new String();
>
> public void Append(String s,String delimeter)
> {
> m_content+=delimeter+s;
> }
>
> public void Show()
> {
> System.out.println(m_content);
> }
>
> public static void ShowProperty(String property)
> {
> System.out.println(System.getProperty(property));
> }
>
>}
>
>I compiled and install it into a ASE15.0.3#4, then start my
>test.
>First I used a variable to test if Java inner method can
>update the Java Object's member value--
>1> declare @s dbjava.AppTest
>2> select @s=new dbjava.AppTest('s1')
>3> select @s>>Append("s2",',')
>4> select @s>>Append("s3",',')
>5> select @s>>Show()
>6> go
>(1 row affected)
>
> ---------------------------------------
> dbjava.AppTest@455f455f
>
>(1 row affected)
>
> ---------------------------------------
> dbjava.AppTest@455f455f
>
>(1 row affected)
>s1,s2,s3
>
> ---------------------------------------
> dbjava.AppTest@455f455f
>
>(1 row affected)
>It shows that the "select" can update the Java Object's
>member value.
>But when I tested with table, things come to be weird...
>
>1> create table t(id int,s dbjava.AppTest)
>2> go
>1> insert t values(1,new dbjava.AppTest('s1'
>2> insert t values(2,new dbjava.AppTest('t1'
>3> go
>(1 row affected)
>(1 row affected)
>1> select s>>Append("s2",",") from t
>2> select s>>Append("s3",",") from t
>3> go
>
> -------------------------------------------
> dbjava.AppTest@7f647f64
> dbjava.AppTest@4690469
>
>(2 rows affected)
>
> -------------------------------------------
> dbjava.AppTest@9590959
> dbjava.AppTest@c110c11
>
>(2 rows affected)
>1> select s>>Show() from t
>2> go
>s1
>
> -------------------------------------------
> dbjava.AppTest@fed0fed
>t1
>
> -------------------------------------------
> dbjava.AppTest@13ae13ae
>
>(2 rows affected)
>I think I'll get s1,s2,s3 and t1,s2,s3 but it's the original
>value...
>The method "Append" invoked by select has not update the
>member value of the Java Object...
>Is it right or not? Or my understanding to Java in ASE is
>something wrong?
>Please help to make it clear. Thanks in advance for your
>help.
>
>Best Regards
>Eisen


Eisen Posted on 2012-03-05 01:29:04.0Z
Sender: 26e2.4f541602.1804289383@sybase.com
From: Eisen
Newsgroups: sybase.public.ase.general
Subject: Re: Sth. strange in Java in ASE
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4f5416e0.272c.1681692777@sybase.com>
References: <4f512897.681564156@forums.sybase.com>
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 4 Mar 2012 17:29:04 -0800
X-Trace: forums-1-dub 1330910944 172.20.134.41 (4 Mar 2012 17:29:04 -0800)
X-Original-Trace: 4 Mar 2012 17:29:04 -0800, 172.20.134.41
Lines: 164
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:30977
Article PK: 73867

Hi Jay
Thanks. But please review the sample of variable -- it's
clear that the Append() in "select" can update the
variable...

Best Regards
Eisen

> On 1 Mar 2012 22:27:03 -0800, Eisen wrote:
>
> If I understand correctly, you never updated the rows of t
> with the "appended" values. You only selected them.
>
> With just one row:
>
> 1> truncate table t
> 2> go
> 1> insert t values(1, new AppTest('s1'))
> 2> go
> (1 row affected)
> 1> select s>>Show() from t
> 2> go
> s1
>
> --------------------------------------------------
> AppTest@72ffb
>
> (1 row affected)
>
> 1> select s>>Append("s2",",") from t
> 2> go
>
> --------------------------------------------------
> AppTest@1df38fd
>
> (1 row affected)
> 1> select s>>Append("s2",",")>>Show() from t
> 2> go
> s1,s2
>
> --------------------------------------------------
> AppTest@16a786
>
> (1 row affected)
>
> Jay
>
> >Dear all
> > I'm new to Java in ASE, So I wrote a short java to
> have a >test --
> >package dbjava;
> >import com.sybase.jdbc3.jdbc.*;
> >
> >public class AppTest implements Serializable
> >{
> >
> > private static final long serialVersionUID = 1L;
> >
> > public static void main(String[] args)
> > {
> > AppTest cibm = new AppTest("");
> > cibm.test();
> > }
> >
> > public AppTest(String s)
> > {
> > m_content = s;
> > }
> >
> > public String m_content = new String();
> >
> > public void Append(String s,String delimeter)
> > {
> > m_content+=delimeter+s;
> > }
> >
> > public void Show()
> > {
> > System.out.println(m_content);
> > }
> >
> > public static void ShowProperty(String property)
> > {
> > System.out.println(System.getProperty(property));
> > }
> >
> >}
> >
> >I compiled and install it into a ASE15.0.3#4, then start
> my >test.
> >First I used a variable to test if Java inner method can
> >update the Java Object's member value--
> >1> declare @s dbjava.AppTest
> >2> select @s=new dbjava.AppTest('s1')
> >3> select @s>>Append("s2",',')
> >4> select @s>>Append("s3",',')
> >5> select @s>>Show()
> >6> go
> >(1 row affected)
> >
> > ---------------------------------------
> > dbjava.AppTest@455f455f
> >
> >(1 row affected)
> >
> > ---------------------------------------
> > dbjava.AppTest@455f455f
> >
> >(1 row affected)
> >s1,s2,s3
> >
> > ---------------------------------------
> > dbjava.AppTest@455f455f
> >
> >(1 row affected)
> >It shows that the "select" can update the Java Object's
> >member value.
> >But when I tested with table, things come to be weird...
> >
> >1> create table t(id int,s dbjava.AppTest)
> >2> go
> >1> insert t values(1,new dbjava.AppTest('s1'
> >2> insert t values(2,new dbjava.AppTest('t1'
> >3> go
> >(1 row affected)
> >(1 row affected)
> >1> select s>>Append("s2",",") from t
> >2> select s>>Append("s3",",") from t
> >3> go
> >
> > -------------------------------------------
> > dbjava.AppTest@7f647f64
> > dbjava.AppTest@4690469
> >
> >(2 rows affected)
> >
> > -------------------------------------------
> > dbjava.AppTest@9590959
> > dbjava.AppTest@c110c11
> >
> >(2 rows affected)
> >1> select s>>Show() from t
> >2> go
> >s1
> >
> > -------------------------------------------
> > dbjava.AppTest@fed0fed
> >t1
> >
> > -------------------------------------------
> > dbjava.AppTest@13ae13ae
> >
> >(2 rows affected)
> >I think I'll get s1,s2,s3 and t1,s2,s3 but it's the
> original >value...
> >The method "Append" invoked by select has not update the
> >member value of the Java Object...
> >Is it right or not? Or my understanding to Java in ASE is
> >something wrong?
> >Please help to make it clear. Thanks in advance for your
> >help.
> >
> >Best Regards
> >Eisen
>


J Posted on 2012-03-05 22:43:46.0Z
From: jtotally_bogus@sbcglobal.net (J)
Newsgroups: sybase.public.ase.general
Subject: Re: Sth. strange in Java in ASE
Reply-To: J@bogusemailAddress.com
Message-ID: <4f553ef7.2227218@forums.sybase.com>
References: <4f512897.681564156@forums.sybase.com> <4f5416e0.272c.1681692777@sybase.com>
X-Newsreader: Forte Free Agent 1.21/32.243
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 5 Mar 2012 14:43:46 -0800
X-Trace: forums-1-dub 1330987426 10.22.241.152 (5 Mar 2012 14:43:46 -0800)
X-Original-Trace: 5 Mar 2012 14:43:46 -0800, vip152.sybase.com
Lines: 199
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:30980
Article PK: 73872

On 4 Mar 2012 17:29:04 -0800, Eisen wrote:

You can update the variable but that does not update the row value.

s is materialized (instantiated) from the row, you then are operating
on that variable value not the value in the actual row.

Here is what I mean:

C:\>isql -Usa -P -Sjanders-xp:1550 -Dxx

1> select s>>Show() from t
2> go
s1

--------------------------------------------------
AppTest@1e04cbf

(1 row affected)
1> update t set s = s>>Append("s2",",") from t
2> go
(1 row affected)

1> select s>>Show() from t
2> go
s1,s2

--------------------------------------------------
AppTest@b988a6

(1 row affected)

Jay

>Hi Jay
> Thanks. But please review the sample of variable -- it's
>clear that the Append() in "select" can update the
>variable...
>
>Best Regards
>Eisen
>> On 1 Mar 2012 22:27:03 -0800, Eisen wrote:
>>
>> If I understand correctly, you never updated the rows of t
>> with the "appended" values. You only selected them.
>>
>> With just one row:
>>
>> 1> truncate table t
>> 2> go
>> 1> insert t values(1, new AppTest('s1'))
>> 2> go
>> (1 row affected)
>> 1> select s>>Show() from t
>> 2> go
>> s1
>>
>> --------------------------------------------------
>> AppTest@72ffb
>>
>> (1 row affected)
>>
>> 1> select s>>Append("s2",",") from t
>> 2> go
>>
>> --------------------------------------------------
>> AppTest@1df38fd
>>
>> (1 row affected)
>> 1> select s>>Append("s2",",")>>Show() from t
>> 2> go
>> s1,s2
>>
>> --------------------------------------------------
>> AppTest@16a786
>>
>> (1 row affected)
>>
>> Jay
>>
>> >Dear all
>> > I'm new to Java in ASE, So I wrote a short java to
>> have a >test --
>> >package dbjava;
>> >import com.sybase.jdbc3.jdbc.*;
>> >
>> >public class AppTest implements Serializable
>> >{
>> >
>> > private static final long serialVersionUID = 1L;
>> >
>> > public static void main(String[] args)
>> > {
>> > AppTest cibm = new AppTest("");
>> > cibm.test();
>> > }
>> >
>> > public AppTest(String s)
>> > {
>> > m_content = s;
>> > }
>> >
>> > public String m_content = new String();
>> >
>> > public void Append(String s,String delimeter)
>> > {
>> > m_content+=delimeter+s;
>> > }
>> >
>> > public void Show()
>> > {
>> > System.out.println(m_content);
>> > }
>> >
>> > public static void ShowProperty(String property)
>> > {
>> > System.out.println(System.getProperty(property));
>> > }
>> >
>> >}
>> >
>> >I compiled and install it into a ASE15.0.3#4, then start
>> my >test.
>> >First I used a variable to test if Java inner method can
>> >update the Java Object's member value--
>> >1> declare @s dbjava.AppTest
>> >2> select @s=new dbjava.AppTest('s1')
>> >3> select @s>>Append("s2",',')
>> >4> select @s>>Append("s3",',')
>> >5> select @s>>Show()
>> >6> go
>> >(1 row affected)
>> >
>> > ---------------------------------------
>> > dbjava.AppTest@455f455f
>> >
>> >(1 row affected)
>> >
>> > ---------------------------------------
>> > dbjava.AppTest@455f455f
>> >
>> >(1 row affected)
>> >s1,s2,s3
>> >
>> > ---------------------------------------
>> > dbjava.AppTest@455f455f
>> >
>> >(1 row affected)
>> >It shows that the "select" can update the Java Object's
>> >member value.
>> >But when I tested with table, things come to be weird...
>> >
>> >1> create table t(id int,s dbjava.AppTest)
>> >2> go
>> >1> insert t values(1,new dbjava.AppTest('s1'
>> >2> insert t values(2,new dbjava.AppTest('t1'
>> >3> go
>> >(1 row affected)
>> >(1 row affected)
>> >1> select s>>Append("s2",",") from t
>> >2> select s>>Append("s3",",") from t
>> >3> go
>> >
>> > -------------------------------------------
>> > dbjava.AppTest@7f647f64
>> > dbjava.AppTest@4690469
>> >
>> >(2 rows affected)
>> >
>> > -------------------------------------------
>> > dbjava.AppTest@9590959
>> > dbjava.AppTest@c110c11
>> >
>> >(2 rows affected)
>> >1> select s>>Show() from t
>> >2> go
>> >s1
>> >
>> > -------------------------------------------
>> > dbjava.AppTest@fed0fed
>> >t1
>> >
>> > -------------------------------------------
>> > dbjava.AppTest@13ae13ae
>> >
>> >(2 rows affected)
>> >I think I'll get s1,s2,s3 and t1,s2,s3 but it's the
>> original >value...
>> >The method "Append" invoked by select has not update the
>> >member value of the Java Object...
>> >Is it right or not? Or my understanding to Java in ASE is
>> >something wrong?
>> >Please help to make it clear. Thanks in advance for your
>> >help.
>> >
>> >Best Regards
>> >Eisen
>>