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.

How to get Hostname, IP address, port number, DB name, instance name using Query

15 posts in General Discussion Last posting was on 2011-02-04 20:11:52.0Z
Keith Posted on 2010-02-04 10:09:04.0Z
Sender: 436f.4b6a9bae.1804289383@sybase.com
From: Keith
Newsgroups: sybase.public.ase.general
Subject: How to get Hostname, IP address, port number, DB name, instance name using Query
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4b6a9cc0.4384.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 4 Feb 2010 02:09:04 -0800
X-Trace: forums-1-dub 1265278144 10.22.241.41 (4 Feb 2010 02:09:04 -0800)
X-Original-Trace: 4 Feb 2010 02:09:04 -0800, 10.22.241.41
Lines: 12
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28946
Article PK: 78187

As we know, normally we connect to a sybase server by just
identifying the node name and interfaces file and necessary
properties, but currently I want to get Host-name, IP
address, port number, DB name, instance name of connected
server out after connection created.
Does any one how to use query to do so? Does sybase provide
such functionality? Seems oracle can do so...

If there is no query, does sybase provides any API which can
implement this?

Thanks!


"Mark A. Parsons" <iron_horse Posted on 2010-02-04 13:40:40.0Z
From: "Mark A. Parsons" <iron_horse@no_spamola.compuserve.com>
User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version: 1.0
Newsgroups: sybase.public.ase.general
Subject: Re: How to get Hostname, IP address, port number, DB name, instance name using Query
References: <4b6a9cc0.4384.1681692777@sybase.com>
In-Reply-To: <4b6a9cc0.4384.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 100126-1, 01/26/2010), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4b6ace58$1@forums-1-dub>
Date: 4 Feb 2010 05:40:40 -0800
X-Trace: forums-1-dub 1265290840 10.22.241.152 (4 Feb 2010 05:40:40 -0800)
X-Original-Trace: 4 Feb 2010 05:40:40 -0800, vip152.sybase.com
Lines: 28
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28947
Article PK: 78188

instance name: select @@servername [assumes the DBA has defined a local entry in syservers]

db name: select db_name() [can be changed with 'use <database>']

ASE host/IP/port# : no way that I'm aware of unless you make a call out to the OS (eg, a shell script) via the XP
server, though the external program/script would need to know which interfaces entry you originally accessed; this info
could also be determined on the client side and then passed in with the connection (eg, isql's -H option, or as an
initial ACF call as the first command once logged in}; must also take into consideration that there can be several
'query' entries in the interfaces file but you won't necessarily know which one your program used to connect to the ASE
instance

NOTE: ACF == Application Context Function; see set_appcontext(), get_appcontext()

Keith wrote:
> As we know, normally we connect to a sybase server by just
> identifying the node name and interfaces file and necessary
> properties, but currently I want to get Host-name, IP
> address, port number, DB name, instance name of connected
> server out after connection created.
> Does any one how to use query to do so? Does sybase provide
> such functionality? Seems oracle can do so...
>
> If there is no query, does sybase provides any API which can
> implement this?
>
> Thanks!


Sherlock, Kevin [TeamSybase] Posted on 2010-02-04 16:08:22.0Z
From: "Sherlock, Kevin [TeamSybase]" <kevin.sherlock@teamsybase.com>
Newsgroups: sybase.public.ase.general
References: <4b6a9cc0.4384.1681692777@sybase.com> <4b6ace58$1@forums-1-dub>
Subject: Re: How to get Hostname, IP address, port number, DB name, instance name using Query
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4b6af0f6@forums-1-dub>
Date: 4 Feb 2010 08:08:22 -0800
X-Trace: forums-1-dub 1265299702 10.22.241.152 (4 Feb 2010 08:08:22 -0800)
X-Original-Trace: 4 Feb 2010 08:08:22 -0800, vip152.sybase.com
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28950
Article PK: 78193

select address_info as "host/port"
,host_name() as "hostname"
,@@servername as "servername"
,db_name() "current_dbname"
from master..syslisteners

"Mark A. Parsons" <iron_horse@no_spamola.compuserve.com> wrote in message
news:4b6ace58$1@forums-1-dub...
> instance name: select @@servername [assumes the DBA has defined a local
> entry in syservers]
>
> db name: select db_name() [can be changed with 'use <database>']
>
> ASE host/IP/port# : no way that I'm aware of unless you make a call out to
> the OS (eg, a shell script) via the XP server, though the external
> program/script would need to know which interfaces entry you originally
> accessed; this info could also be determined on the client side and then
> passed in with the connection (eg, isql's -H option, or as an initial ACF
> call as the first command once logged in}; must also take into
> consideration that there can be several 'query' entries in the interfaces
> file but you won't necessarily know which one your program used to connect
> to the ASE instance
>
> NOTE: ACF == Application Context Function; see set_appcontext(),
> get_appcontext()
>
>
>
> Keith wrote:
>> As we know, normally we connect to a sybase server by just
>> identifying the node name and interfaces file and necessary
>> properties, but currently I want to get Host-name, IP
>> address, port number, DB name, instance name of connected
>> server out after connection created.
>> Does any one how to use query to do so? Does sybase provide
>> such functionality? Seems oracle can do so...
>>
>> If there is no query, does sybase provides any API which can
>> implement this?
>>
>> Thanks!


"Mark A. Parsons" <iron_horse Posted on 2010-02-04 16:29:19.0Z
From: "Mark A. Parsons" <iron_horse@no_spamola.compuserve.com>
User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version: 1.0
Newsgroups: sybase.public.ase.general
Subject: Re: How to get Hostname, IP address, port number, DB name, instance name using Query
References: <4b6a9cc0.4384.1681692777@sybase.com> <4b6ace58$1@forums-1-dub> <4b6af0f6@forums-1-dub>
In-Reply-To: <4b6af0f6@forums-1-dub>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 100126-1, 01/26/2010), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4b6af5df$1@forums-1-dub>
Date: 4 Feb 2010 08:29:19 -0800
X-Trace: forums-1-dub 1265300959 10.22.241.152 (4 Feb 2010 08:29:19 -0800)
X-Original-Trace: 4 Feb 2010 08:29:19 -0800, vip152.sybase.com
Lines: 50
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28951
Article PK: 78191

syslisteners provides a list of currently active listeners. And as with the interfaces file, there can be multiple
entries in syslisteners.

syslisteners can't tell us which listener a particular spid used to connect to ASE.

Sherlock, Kevin [TeamSybase] wrote:
> select address_info as "host/port"
> ,host_name() as "hostname"
> ,@@servername as "servername"
> ,db_name() "current_dbname"
> from master..syslisteners
>
> "Mark A. Parsons" <iron_horse@no_spamola.compuserve.com> wrote in message
> news:4b6ace58$1@forums-1-dub...
>> instance name: select @@servername [assumes the DBA has defined a local
>> entry in syservers]
>>
>> db name: select db_name() [can be changed with 'use <database>']
>>
>> ASE host/IP/port# : no way that I'm aware of unless you make a call out to
>> the OS (eg, a shell script) via the XP server, though the external
>> program/script would need to know which interfaces entry you originally
>> accessed; this info could also be determined on the client side and then
>> passed in with the connection (eg, isql's -H option, or as an initial ACF
>> call as the first command once logged in}; must also take into
>> consideration that there can be several 'query' entries in the interfaces
>> file but you won't necessarily know which one your program used to connect
>> to the ASE instance
>>
>> NOTE: ACF == Application Context Function; see set_appcontext(),
>> get_appcontext()
>>
>>
>>
>> Keith wrote:
>>> As we know, normally we connect to a sybase server by just
>>> identifying the node name and interfaces file and necessary
>>> properties, but currently I want to get Host-name, IP
>>> address, port number, DB name, instance name of connected
>>> server out after connection created.
>>> Does any one how to use query to do so? Does sybase provide
>>> such functionality? Seems oracle can do so...
>>>
>>> If there is no query, does sybase provides any API which can
>>> implement this?
>>>
>>> Thanks!
>
>


"Mark A. Parsons" <iron_horse Posted on 2010-02-04 16:37:45.0Z
From: "Mark A. Parsons" <iron_horse@no_spamola.compuserve.com>
User-Agent: Thunderbird 1.5.0.10 (Windows/20070221)
MIME-Version: 1.0
Newsgroups: sybase.public.ase.general
Subject: Re: How to get Hostname, IP address, port number, DB name, instancename using Query
References: <4b6a9cc0.4384.1681692777@sybase.com> <4b6ace58$1@forums-1-dub> <4b6af0f6@forums-1-dub> <4b6af5df$1@forums-1-dub>
In-Reply-To: <4b6af5df$1@forums-1-dub>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 100126-1, 01/26/2010), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4b6af7d9$1@forums-1-dub>
Date: 4 Feb 2010 08:37:45 -0800
X-Trace: forums-1-dub 1265301465 10.22.241.152 (4 Feb 2010 08:37:45 -0800)
X-Original-Trace: 4 Feb 2010 08:37:45 -0800, vip152.sybase.com
Lines: 58
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28952
Article PK: 78192

clarification ...

syslisteners contains an entry for all listeners currently in use by the dataserver; this includes active and suspended
listeners

Mark A. Parsons wrote:
> syslisteners provides a list of currently active listeners. And as with
> the interfaces file, there can be multiple entries in syslisteners.
>
> syslisteners can't tell us which listener a particular spid used to
> connect to ASE.
>
>
> Sherlock, Kevin [TeamSybase] wrote:
>> select address_info as "host/port"
>> ,host_name() as "hostname"
>> ,@@servername as "servername"
>> ,db_name() "current_dbname"
>> from master..syslisteners
>>
>> "Mark A. Parsons" <iron_horse@no_spamola.compuserve.com> wrote in
>> message news:4b6ace58$1@forums-1-dub...
>>> instance name: select @@servername [assumes the DBA has defined a
>>> local entry in syservers]
>>>
>>> db name: select db_name() [can be changed with 'use <database>']
>>>
>>> ASE host/IP/port# : no way that I'm aware of unless you make a call
>>> out to the OS (eg, a shell script) via the XP server, though the
>>> external program/script would need to know which interfaces entry you
>>> originally accessed; this info could also be determined on the client
>>> side and then passed in with the connection (eg, isql's -H option, or
>>> as an initial ACF call as the first command once logged in}; must
>>> also take into consideration that there can be several 'query'
>>> entries in the interfaces file but you won't necessarily know which
>>> one your program used to connect to the ASE instance
>>>
>>> NOTE: ACF == Application Context Function; see set_appcontext(),
>>> get_appcontext()
>>>
>>>
>>>
>>> Keith wrote:
>>>> As we know, normally we connect to a sybase server by just
>>>> identifying the node name and interfaces file and necessary
>>>> properties, but currently I want to get Host-name, IP
>>>> address, port number, DB name, instance name of connected
>>>> server out after connection created.
>>>> Does any one how to use query to do so? Does sybase provide
>>>> such functionality? Seems oracle can do so...
>>>>
>>>> If there is no query, does sybase provides any API which can
>>>> implement this?
>>>>
>>>> Thanks!
>>
>>


Sherlock, Kevin [TeamSybase] Posted on 2010-02-04 17:16:32.0Z
From: "Sherlock, Kevin [TeamSybase]" <kevin.sherlock@teamsybase.com>
Newsgroups: sybase.public.ase.general
References: <4b6a9cc0.4384.1681692777@sybase.com> <4b6ace58$1@forums-1-dub> <4b6af0f6@forums-1-dub> <4b6af5df$1@forums-1-dub>
Subject: Re: How to get Hostname, IP address, port number, DB name, instance name using Query
Lines: 61
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4b6b00f0@forums-1-dub>
Date: 4 Feb 2010 09:16:32 -0800
X-Trace: forums-1-dub 1265303792 10.22.241.152 (4 Feb 2010 09:16:32 -0800)
X-Original-Trace: 4 Feb 2010 09:16:32 -0800, vip152.sybase.com
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28953
Article PK: 78194

I didn't read that into the OP's requirements.

dbcc listener("status") will reveal active listeners.

I guess since this is aimed at open-client (based on interfaces file), this
is probably on open-client related piece of information somewhere in that
api perhaps.

"Mark A. Parsons" <iron_horse@no_spamola.compuserve.com> wrote in message
news:4b6af5df$1@forums-1-dub...
> syslisteners provides a list of currently active listeners. And as with
> the interfaces file, there can be multiple entries in syslisteners.
>
> syslisteners can't tell us which listener a particular spid used to
> connect to ASE.
>
>
> Sherlock, Kevin [TeamSybase] wrote:
>> select address_info as "host/port"
>> ,host_name() as "hostname"
>> ,@@servername as "servername"
>> ,db_name() "current_dbname"
>> from master..syslisteners
>>
>> "Mark A. Parsons" <iron_horse@no_spamola.compuserve.com> wrote in message
>> news:4b6ace58$1@forums-1-dub...
>>> instance name: select @@servername [assumes the DBA has defined a local
>>> entry in syservers]
>>>
>>> db name: select db_name() [can be changed with 'use <database>']
>>>
>>> ASE host/IP/port# : no way that I'm aware of unless you make a call out
>>> to the OS (eg, a shell script) via the XP server, though the external
>>> program/script would need to know which interfaces entry you originally
>>> accessed; this info could also be determined on the client side and then
>>> passed in with the connection (eg, isql's -H option, or as an initial
>>> ACF call as the first command once logged in}; must also take into
>>> consideration that there can be several 'query' entries in the
>>> interfaces file but you won't necessarily know which one your program
>>> used to connect to the ASE instance
>>>
>>> NOTE: ACF == Application Context Function; see set_appcontext(),
>>> get_appcontext()
>>>
>>>
>>>
>>> Keith wrote:
>>>> As we know, normally we connect to a sybase server by just
>>>> identifying the node name and interfaces file and necessary
>>>> properties, but currently I want to get Host-name, IP
>>>> address, port number, DB name, instance name of connected
>>>> server out after connection created.
>>>> Does any one how to use query to do so? Does sybase provide
>>>> such functionality? Seems oracle can do so...
>>>>
>>>> If there is no query, does sybase provides any API which can
>>>> implement this?
>>>>
>>>> Thanks!
>>


Neal Stack [Sybase] Posted on 2010-02-04 15:00:14.0Z
From: "Neal Stack [Sybase]" <nstack@nospam.com>
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
Newsgroups: sybase.public.ase.general
Subject: Re: How to get Hostname, IP address, port number, DB name, instance name using Query
References: <4b6a9cc0.4384.1681692777@sybase.com>
In-Reply-To: <4b6a9cc0.4384.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4b6ae0fe$1@forums-1-dub>
Date: 4 Feb 2010 07:00:14 -0800
X-Trace: forums-1-dub 1265295614 10.22.241.152 (4 Feb 2010 07:00:14 -0800)
X-Original-Trace: 4 Feb 2010 07:00:14 -0800, vip152.sybase.com
Lines: 13
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28949
Article PK: 78189

Hello,

Most of the client APIs (DB-Library, CT-Library, etc.) have properties
that you can retrieve that will return this information.

For example, CT-Library has CS_SERVERNAME, CS_PROP_APPLICATION_SPID, etc...
http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc32840.1500/html/ctref/X57953.htm

Some properties can only be retrieved after the connection has been
established. Some can be set before establishing a connection.

Regards,
Neal


bigbassdaddy Posted on 2011-02-04 14:24:25.0Z
Sender: 5482.4d4c0b2e.1804289383@sybase.com
From: bigbassdaddy@gmail.com
Newsgroups: sybase.public.ase.general
Subject: Re: How to get Hostname, IP address, port number, DB name, instance name using Query
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4d4c0c19.54a4.1681692777@sybase.com>
References: <4b6ae0fe$1@forums-1-dub>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 4 Feb 2011 06:24:25 -0800
X-Trace: forums-1-dub 1296829465 10.22.241.41 (4 Feb 2011 06:24:25 -0800)
X-Original-Trace: 4 Feb 2011 06:24:25 -0800, 10.22.241.41
Lines: 26
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29919
Article PK: 79149


> Hello,
>
> Most of the client APIs (DB-Library, CT-Library, etc.)
> have properties that you can retrieve that will return
> this information.
>
> For example, CT-Library has CS_SERVERNAME,
> CS_PROP_APPLICATION_SPID, etc...
>

Neal,
CS_PROP_APPLICATION_SPID does not seem to be supported.
What's up?

ct_con_props(): user api layer: external error: An illegal
value of 9210 given for parameter property.


>
http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc32840.1500/html/ctref/X57953.htm
>
> Some properties can only be retrieved after the connection
> has been established. Some can be set before
> establishing a connection.
>
> Regards,
> Neal


Neal Stack [Sybase] Posted on 2011-02-04 15:00:50.0Z
Message-ID: <4D4C14A2.9000302@nospam.com>
From: "Neal Stack [Sybase]" <nstack@nospam.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7
MIME-Version: 1.0
Newsgroups: sybase.public.ase.general
To: bigbassdaddy@gmail.com
Subject: Re: How to get Hostname, IP address, port number, DB name, instance name using Query
References: <4b6ae0fe$1@forums-1-dub> <4d4c0c19.54a4.1681692777@sybase.com>
In-Reply-To: <4d4c0c19.54a4.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 4 Feb 2011 07:00:50 -0800
X-Trace: forums-1-dub 1296831650 10.22.241.152 (4 Feb 2011 07:00:50 -0800)
X-Original-Trace: 4 Feb 2011 07:00:50 -0800, vip152.sybase.com
Lines: 6
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29920
Article PK: 79148

Hello,

I believe CS_PROP_APPLICATION_SPID was added in 15.0. Are you using 15.0?

Thanks,
Neal


bigbassdaddy Posted on 2011-02-04 15:41:56.0Z
Sender: 5482.4d4c0b2e.1804289383@sybase.com
From: bigbassdaddy@gmail.com
Newsgroups: sybase.public.ase.general
Subject: Re: How to get Hostname, IP address, port number, DB name, instance name using Query
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4d4c1e44.5854.1681692777@sybase.com>
References: <4D4C14A2.9000302@nospam.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 4 Feb 2011 07:41:56 -0800
X-Trace: forums-1-dub 1296834116 10.22.241.41 (4 Feb 2011 07:41:56 -0800)
X-Original-Trace: 4 Feb 2011 07:41:56 -0800, 10.22.241.41
Lines: 16
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29921
Article PK: 79150


> Hello,
>
> I believe CS_PROP_APPLICATION_SPID was added in 15.0. Are
> you using 15.0?
>
> Thanks,
> Neal

Hi Neal,

Linux 64bit
select @@version_number, @@version_as_integer
15500 15000

Thanks,
John


Neal Stack [Sybase] Posted on 2011-02-04 15:48:54.0Z
Message-ID: <4D4C1FE6.8050005@nospam.com>
From: "Neal Stack [Sybase]" <nstack@nospam.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7
MIME-Version: 1.0
Newsgroups: sybase.public.ase.general
To: bigbassdaddy@gmail.com
Subject: Re: How to get Hostname, IP address, port number, DB name, instance name using Query
References: <4D4C14A2.9000302@nospam.com> <4d4c1e44.5854.1681692777@sybase.com>
In-Reply-To: <4d4c1e44.5854.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 4 Feb 2011 07:48:54 -0800
X-Trace: forums-1-dub 1296834534 10.22.241.152 (4 Feb 2011 07:48:54 -0800)
X-Original-Trace: 4 Feb 2011 07:48:54 -0800, vip152.sybase.com
Lines: 42
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29922
Article PK: 79151

Hello,

But is your client application being built with 15.0? I just tried it
with 15.0 and it seems to work fine.

To check your client library version:
strings -a $SYBASE/$SYBASE_OCS/lib/libsybct.so | grep Sybase

/*
** Create the connection.
*/
if(EX_SERVER==NULL)
ret = ct_connect(connection, (CS_CHAR *)NULL, 0);
else
ret = ct_connect(connection, (CS_CHAR *)EX_SERVER,
strlen(EX_SERVER));
EXIT_ON_FAIL(context, ret, "Could not connect!");

ret = ct_con_props(connection, CS_GET, CS_PROP_APPLICATION_SPID,
&spid, CS_UNUSED, NULL);

printf("My ASE spid is %d\n", spid);


% make firstapp
cc -g -Xa -mt -D_REENTRANT -I. -I/software/ase1502/OCS-15_0/include
-Dnthread_sun_svr4=1 firstapp.c -L/software/ase1502/OCS-15_0/lib
-lsybct_r -lsybtcl_r -lsybcs_r -lsybcomn_r -lsybintl_r -lsybunic
-R/usr/lib/lwp -B dynamic -lsocket -lnsl -ldl -lpthread -lthread -lm -o
firstapp

% firstapp
Server message:
number(5701) severity(10) state(2) line(0)
Server name: NSTACKSUN155
Changed database context to 'master'.

My ASE spid is 20
White: Menlo Park
Green: Oakland
Carson: Berkeley
...etc...


bigbassdaddy Posted on 2011-02-04 16:10:16.0Z
Sender: 585d.4d4c1e67.1804289383@sybase.com
From: bigbassdaddy@gmail.com
Newsgroups: sybase.public.ase.general
Subject: Re: How to get Hostname, IP address, port number, DB name, instance name using Query
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4d4c24e8.5930.1681692777@sybase.com>
References: <4D4C1FE6.8050005@nospam.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 4 Feb 2011 08:10:16 -0800
X-Trace: forums-1-dub 1296835816 10.22.241.41 (4 Feb 2011 08:10:16 -0800)
X-Original-Trace: 4 Feb 2011 08:10:16 -0800, 10.22.241.41
Lines: 66
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29923
Article PK: 79152


> Hello,
>
> But is your client application being built with 15.0? I
> just tried it with 15.0 and it seems to work fine.
>
> To check your client library version:
> strings -a $SYBASE/$SYBASE_OCS/lib/libsybct.so | grep
> Sybase
>

As far as I can tell it is being build with the correct
libs. How can I be sure?

make
`sh sybopts.sh compile` -I. -I/indy/sybase/OCS-15_0/include
-Dlinux64=1 otc_interface.c -O -D__linux__ -c
-oobj/otc_interface.o

cc -L/indy/sybase/OCS-15_0/lib -lsybcs64 -lsybcomn64
-lsybct64 -lsybtcl64 -lpthread obj/otc_interface.o

INDLNXPBUS(sybase):[/indy/sybase/OCS-15_0/lib]> ls -l
-rw-r--r-- 1 sybase dba 132274 Apr 18 2010 libsybcs64.a
-rwxr-xr-x 1 sybase dba 86323 Apr 18 2010 libsybcs64.so
-rw-r--r-- 1 sybase dba 1182848 Apr 18 2010 libsybct64.a
-rwxr-xr-x 1 sybase dba 678670 Apr 18 2010 libsybct64.so
-rw-r--r-- 1 sybase dba 1377230 Apr 18 2010 libsybcomn64.a
-rwxr-xr-x 1 sybase dba 845966 Apr 18 2010 libsybcomn64.so


> /*
> ** Create the connection.
> */
> if(EX_SERVER==NULL)
> ret = ct_connect(connection, (CS_CHAR
> *)NULL, 0);
> else
> ret = ct_connect(connection, (CS_CHAR
> *)EX_SERVER, strlen(EX_SERVER));
> EXIT_ON_FAIL(context, ret, "Could not connect!");
>
> ret = ct_con_props(connection, CS_GET,
> CS_PROP_APPLICATION_SPID,
> &spid, CS_UNUSED, NULL);
>
> printf("My ASE spid is %d\n", spid);
>
>
> % make firstapp
> cc -g -Xa -mt -D_REENTRANT -I.
> -I/software/ase1502/OCS-15_0/include -Dnthread_sun_svr4=1
> firstapp.c -L/software/ase1502/OCS-15_0/lib -lsybct_r
> -lsybtcl_r -lsybcs_r -lsybcomn_r -lsybintl_r -lsybunic
> -R/usr/lib/lwp -B dynamic -lsocket -lnsl -ldl -lpthread
> -lthread -lm -o firstapp
>
> % firstapp
> Server message:
> number(5701) severity(10) state(2) line(0)
> Server name: NSTACKSUN155
> Changed database context to 'master'.
>
> My ASE spid is 20
> White: Menlo Park
> Green: Oakland
> Carson: Berkeley
> ...etc...


bigbassdaddy Posted on 2011-02-04 16:15:33.0Z
Sender: 585d.4d4c1e67.1804289383@sybase.com
From: bigbassdaddy@gmail.com
Newsgroups: sybase.public.ase.general
Subject: Re: How to get Hostname, IP address, port number, DB name, instance name using Query
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4d4c2625.59d8.1681692777@sybase.com>
References: <4d4c24e8.5930.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 4 Feb 2011 08:15:33 -0800
X-Trace: forums-1-dub 1296836133 10.22.241.41 (4 Feb 2011 08:15:33 -0800)
X-Original-Trace: 4 Feb 2011 08:15:33 -0800, 10.22.241.41
Lines: 12
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29924
Article PK: 79153

Library version is 15.x.

Confidential property of Sybase, Inc.
Sybase, Inc. All rights reserved.
This software contains confidential and trade secret
information of Sybase,
agreement between the Government and Sybase, Inc. or
other written
Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
Sybase Client-Library/15.5/P-EBF17747 ESD
#4/DRV.15.5.1/Linux Intel/Linux 2.6.9-55.ELsmp
x86_64/BUILD1550-006/OPT/Sun Apr 18 01:02:52 2010


Neal Stack [Sybase] Posted on 2011-02-04 16:47:08.0Z
Message-ID: <4D4C2D8C.7060400@nospam.com>
From: "Neal Stack [Sybase]" <nstack@nospam.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7
MIME-Version: 1.0
Newsgroups: sybase.public.ase.general
To: bigbassdaddy@gmail.com
Subject: Re: How to get Hostname, IP address, port number, DB name, instance name using Query
References: <4d4c24e8.5930.1681692777@sybase.com> <4d4c2625.59d8.1681692777@sybase.com>
In-Reply-To: <4d4c2625.59d8.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 4 Feb 2011 08:47:08 -0800
X-Trace: forums-1-dub 1296838028 10.22.241.152 (4 Feb 2011 08:47:08 -0800)
X-Original-Trace: 4 Feb 2011 08:47:08 -0800, vip152.sybase.com
Lines: 33
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29925
Article PK: 79154

Are you running it against the same version of libraries you compiled it
against?

To see which libraries it is loading at run-time, type:
ldd your_program_name

Also, the compile command you are using for that platform does not look
quite right to me. If you are building with the x86_64 libs it should
look something like this:

make firstapp
cc -m64 -g -DSYB_LP64 -I. -I/nstack/SDK155/OCS-15_0/include
-Dlinuxamd64=1 firstapp.c -L/nstack/SDK155/OCS-15_0/lib -lsybct64
-lsybtcl64 -lsybcs64 -lsybcomn64 -lsybintl64 -lsybunic64 -Wl,-Bdynamic
-ldl -lnsl -lm -o firstapp

[nstack@redeye ctlibrary]$ firstapp
Server message:
number(5701) severity(10) state(2) line(0)
Server name: NSTACKSUN155
Changed database context to 'master'.

My ASE spid is 16


Notice the "-m64" and "-DSYB_LP64"....
http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc35456.1550/html/ocspsunx/ocspsunx100.htm

Another suggestion, try modifying the sample
$SYBASE/$SYBASE_OCS/sample/ctlibrary/firstapp.c like I did, compile it
and run it. If it doesn't complain than your environment is correct but
you will need to look at what is different with your application (source
code, header files, compile command, etc.).


bigbassdaddy Posted on 2011-02-04 20:11:52.0Z
Sender: 585d.4d4c1e67.1804289383@sybase.com
From: bigbassdaddy@gmail.com
Newsgroups: sybase.public.ase.general
Subject: Re: How to get Hostname, IP address, port number, DB name, instance name using Query
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4d4c5d88.61a5.1681692777@sybase.com>
References: <4D4C2D8C.7060400@nospam.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 4 Feb 2011 12:11:52 -0800
X-Trace: forums-1-dub 1296850312 10.22.241.41 (4 Feb 2011 12:11:52 -0800)
X-Original-Trace: 4 Feb 2011 12:11:52 -0800, 10.22.241.41
Lines: 17
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29926
Article PK: 79155

Neal,
Thanks for your assistance. As usual, the problem was the
most obvious:
I had:
cs_ctx_alloc( CS_VERSION_100,
I shoulda had:
cs_ctx_alloc( CS_VERSION_150,

However, by you having me look at my make file & sybopts.sh
I found that I had ${SYBPLATFORM} set to "linux64". This
application is multi-threaded and I didn't know that there
were different compile flags and libraries on Linux for
"re-entrant" code, so I changed SYBPLATFORM=nthread_linux64.
Not a total waste of time I hope.

Thanks again,
John