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.

IP Address from Server

6 posts in General Discussion Last posting was on 2005-07-28 14:22:25.0Z
stevetx30 Posted on 2005-07-26 22:15:37.0Z
Sender: 1f6b.42e6b4f2.1804289383@sybase.com
From: Stevetx30
Newsgroups: ianywhere.public.general
Subject: IP Address from Server
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <42e6b609.1f75.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 26 Jul 2005 15:15:37 -0700
X-Trace: forums-1-dub 1122416137 10.22.241.41 (26 Jul 2005 15:15:37 -0700)
X-Original-Trace: 26 Jul 2005 15:15:37 -0700, 10.22.241.41
Lines: 10
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4643
Article PK: 8446

Windows 2000
ASA 9.0.2.2451

Is there a way I can get the IP address of the database
server from the client using embed SQL. I do not need IP of
the client such as SELECT connection_property
('NodeAddress')

Thanks
Steve


Shuchit Posted on 2005-07-27 00:52:47.0Z
Newsgroups: ianywhere.public.general
Subject: Re: IP Address from Server
From: Shuchit <me@privacy.net>
References: <42e6b609.1f75.1681692777@sybase.com>
Message-ID: <Xns969FD454BD0CDsvelkarprivacynet@127.0.0.1>
User-Agent: Xnews/??.01.30 Hamster/2.0.6.0
X-Original-NNTP-Posting-Host: cpe0080c6ee7d81-cm024340006571.cpe.net.cable.rogers.com
X-Original-Trace: 26 Jul 2005 17:52:43 -0700, cpe0080c6ee7d81-cm024340006571.cpe.net.cable.rogers.com
Lines: 17
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 26 Jul 2005 17:52:44 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 26 Jul 2005 17:52:47 -0700
X-Trace: forums-1-dub 1122425567 10.22.108.75 (26 Jul 2005 17:52:47 -0700)
X-Original-Trace: 26 Jul 2005 17:52:47 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4644
Article PK: 8448


Stevetx30 wrote in news:42e6b609.1f75.1681692777@sybase.com:

>
> Windows 2000
> ASA 9.0.2.2451
>
> Is there a way I can get the IP address of the database
> server from the client using embed SQL.

SELECT property ( 'Machinename' )

This is documented here <http://tinyurl.com/a84qz> which points to

<http://www.ianywhere.com/developer/product_manuals/sqlanywhere/0902/en/html/
dbdaen9/00000786.htm>

Shuchit


Andrew Giulinn Posted on 2005-07-27 01:22:38.0Z
From: "Andrew Giulinn" <NO.oscar.SPAM@dsa.com.au>
Newsgroups: ianywhere.public.general
References: <42e6b609.1f75.1681692777@sybase.com> <Xns969FD454BD0CDsvelkarprivacynet@127.0.0.1>
Subject: Re: IP Address from Server
Lines: 35
Organization: Daniel Systems Australia
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: eth9935.sa.adsl.internode.on.net
X-Original-NNTP-Posting-Host: eth9935.sa.adsl.internode.on.net
Message-ID: <42e6e1de$1@forums-1-dub>
Date: 26 Jul 2005 18:22:38 -0700
X-Trace: forums-1-dub 1122427358 150.101.15.206 (26 Jul 2005 18:22:38 -0700)
X-Original-Trace: 26 Jul 2005 18:22:38 -0700, eth9935.sa.adsl.internode.on.net
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4645
Article PK: 8450

That just gives me the machine name, not the IP address.

Does anyone know under what circumstances the "or IP address" part of the
Help for "SELECT property ( 'Machinename' )" kicks in?

We use that select to get the server's machine name, then we use a Windows
API to find out the IP address of the machine named as the server. If
embedded SQL is a requirement for the OP that won't help, but I can give
more details of the API call we use if needed.

Cheers

Andrew

"Shuchit" <me@privacy.net> wrote in message
news:Xns969FD454BD0CDsvelkarprivacynet@127.0.0.1...
> Stevetx30 wrote in news:42e6b609.1f75.1681692777@sybase.com:
>
>>
>> Windows 2000
>> ASA 9.0.2.2451
>>
>> Is there a way I can get the IP address of the database
>> server from the client using embed SQL.
>
> SELECT property ( 'Machinename' )
>
> This is documented here <http://tinyurl.com/a84qz> which points to
>
> <http://www.ianywhere.com/developer/product_manuals/sqlanywhere/0902/en/html/
> dbdaen9/00000786.htm>
>
> Shuchit


Breck Carter [TeamSybase] Posted on 2005-07-27 11:03:44.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: Re: IP Address from Server
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <bgqee1hkmi3g2n94unp0k16jkhlthjg4mh@4ax.com>
References: <42e6b609.1f75.1681692777@sybase.com> <Xns969FD454BD0CDsvelkarprivacynet@127.0.0.1> <42e6e1de$1@forums-1-dub>
X-Newsreader: Forte Agent 2.0/32.640
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 208.254.244.99
X-Original-NNTP-Posting-Host: 208.254.244.99
Date: 27 Jul 2005 04:03:44 -0700
X-Trace: forums-1-dub 1122462224 208.254.244.99 (27 Jul 2005 04:03:44 -0700)
X-Original-Trace: 27 Jul 2005 04:03:44 -0700, 208.254.244.99
Lines: 28
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4648
Article PK: 8452

On 26 Jul 2005 18:22:38 -0700, "Andrew Giulinn"

<NO.oscar.SPAM@dsa.com.au> wrote:

>That just gives me the machine name, not the IP address.
>
>Does anyone know under what circumstances the "or IP address" part of the
>Help for "SELECT property ( 'Machinename' )" kicks in?
>
>We use that select to get the server's machine name, then we use a Windows
>API to find out the IP address of the machine named as the server. If
>embedded SQL is a requirement for the OP that won't help, but I can give
>more details of the API call we use if needed.
>
>Cheers
>
>Andrew

Yes, please, I would like to know about the API call that works for
you... thanks!

Breck

--
SQL Anywhere Studio 9 Developer's Guide
Buy the book: http://www.amazon.com/exec/obidos/ASIN/1556225067/risingroad-20
bcarter@risingroad.com
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com


Andrew Giulinn Posted on 2005-07-27 23:04:37.0Z
From: "Andrew Giulinn" <NO.oscar.SPAM@dsa.com.au>
Newsgroups: ianywhere.public.general
References: <42e6b609.1f75.1681692777@sybase.com> <Xns969FD454BD0CDsvelkarprivacynet@127.0.0.1> <42e6e1de$1@forums-1-dub> <bgqee1hkmi3g2n94unp0k16jkhlthjg4mh@4ax.com>
Subject: Re: IP Address from Server
Lines: 91
Organization: Daniel Systems Australia
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-Original-NNTP-Posting-Host: eth9935.sa.adsl.internode.on.net
Message-ID: <42e812ff@forums-2-dub>
X-Original-Trace: 27 Jul 2005 16:04:31 -0700, eth9935.sa.adsl.internode.on.net
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 27 Jul 2005 16:04:34 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 27 Jul 2005 16:04:37 -0700
X-Trace: forums-1-dub 1122505477 10.22.108.75 (27 Jul 2005 16:04:37 -0700)
X-Original-Trace: 27 Jul 2005 16:04:37 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4651
Article PK: 8456

Breck (et al)

The following is material previously posted in the Sybase newsgroups. It
originated (AFAIK) with Roland Smith. We are using it in PowerBuilder 10.

We have a function: of_getIPAddress(string as_hostname) returns string

It uses a number of API calls:

Function ulong gethostbyname (string name) Library "ws2_32.dll" Alias for
"gethostbyname;Ansi"
Subroutine CopyMemoryIP (Ref hostent Destination, ulong Source, long Length)
Library "kernel32.dll" Alias For "RtlMoveMemory"
Subroutine CopyMemoryIP (Ref blob Destination, ulong Source, long Length)
Library "kernel32.dll" Alias For "RtlMoveMemory"
Subroutine CopyMemoryIP (Ref ulong Destination, ulong Source, long Length)
Library "kernel32.dll" Alias For "RtlMoveMemory"

The function code is as follows:

String ls_ipaddress = "0.0.0.0"
string ls_errmsg
Blob lblb_ipaddr
hostent lstr_host
ULong lul_ptr, lul_ipaddr

// get information about host
lul_ptr = gethostbyname(as_hostname)

If lul_ptr > 0 Then
// copy structure to local structure
CopyMemoryIP(lstr_host, lul_ptr, 16)
// get memory address where ipaddress is located
CopyMemoryIP(lul_ipaddr, lstr_host.h_addr_list, 4)
// copy ipaddress to local blob
lblb_ipaddr = Blob(Space(4),EncodingAnsi!)
CopyMemoryIP(lblb_ipaddr, lul_ipaddr, 4)
// convert blob to string ip address
ls_ipaddress =
String(AscA(String(BlobMid(lblb_ipaddr,1,1),EncodingAnsi!)),"##0") + "."
ls_ipaddress +=
String(AscA(String(BlobMid(lblb_ipaddr,2,1),EncodingAnsi!)),"##0") + "."
ls_ipaddress +=
String(AscA(String(BlobMid(lblb_ipaddr,3,1),EncodingAnsi!)),"##0") + "."
ls_ipaddress +=
String(AscA(String(BlobMid(lblb_ipaddr,4,1),EncodingAnsi!)),"##0")
End If

Return ls_ipaddress

Hope that helps.

Cheers
--
Andrew Giulinn
Senior Analyst/Programmer
Integrated Aviation Software Pty Ltd

"Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com> wrote in
message news:bgqee1hkmi3g2n94unp0k16jkhlthjg4mh@4ax.com...
> On 26 Jul 2005 18:22:38 -0700, "Andrew Giulinn"
> <NO.oscar.SPAM@dsa.com.au> wrote:
>
>>That just gives me the machine name, not the IP address.
>>
>>Does anyone know under what circumstances the "or IP address" part of the
>>Help for "SELECT property ( 'Machinename' )" kicks in?
>>
>>We use that select to get the server's machine name, then we use a Windows
>>API to find out the IP address of the machine named as the server. If
>>embedded SQL is a requirement for the OP that won't help, but I can give
>>more details of the API call we use if needed.
>>
>>Cheers
>>
>>Andrew
>
> Yes, please, I would like to know about the API call that works for
> you... thanks!
>
> Breck
>
> --
> SQL Anywhere Studio 9 Developer's Guide
> Buy the book:
> http://www.amazon.com/exec/obidos/ASIN/1556225067/risingroad-20
> bcarter@risingroad.com
> RisingRoad SQL Anywhere and MobiLink Professional Services
> www.risingroad.com


stevetx30 Posted on 2005-07-28 14:22:25.0Z
Sender: 4d6a.42e8e9f7.1804289383@sybase.com
From: Stevetx30
Newsgroups: ianywhere.public.general
Subject: Re: IP Address from Server
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <42e8ea19.4d6e.1681692777@sybase.com>
References: <42e812ff@forums-2-dub>
X-Original-NNTP-Posting-Host: 10.22.241.42
X-Original-Trace: 28 Jul 2005 07:22:17 -0700, 10.22.241.42
Lines: 104
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 28 Jul 2005 07:22:20 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 28 Jul 2005 07:22:25 -0700
X-Trace: forums-1-dub 1122560545 10.22.108.75 (28 Jul 2005 07:22:25 -0700)
X-Original-Trace: 28 Jul 2005 07:22:25 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4652
Article PK: 8458

Andrew,

Thanks for your help
Steve

> Breck (et al)
>
> The following is material previously posted in the Sybase
> newsgroups. It originated (AFAIK) with Roland Smith. We
> are using it in PowerBuilder 10.
>
> We have a function: of_getIPAddress(string as_hostname)
> returns string
>
> It uses a number of API calls:
>
> Function ulong gethostbyname (string name) Library
> "ws2_32.dll" Alias for "gethostbyname;Ansi"
> Subroutine CopyMemoryIP (Ref hostent Destination, ulong
> Source, long Length) Library "kernel32.dll" Alias For
> "RtlMoveMemory" Subroutine CopyMemoryIP (Ref blob
> Destination, ulong Source, long Length) Library
> "kernel32.dll" Alias For "RtlMoveMemory" Subroutine
> CopyMemoryIP (Ref ulong Destination, ulong Source, long
> Length) Library "kernel32.dll" Alias For "RtlMoveMemory"
>
> The function code is as follows:
>
> String ls_ipaddress = "0.0.0.0"
> string ls_errmsg
> Blob lblb_ipaddr
> hostent lstr_host
> ULong lul_ptr, lul_ipaddr
>
> // get information about host
> lul_ptr = gethostbyname(as_hostname)
>
> If lul_ptr > 0 Then
> // copy structure to local structure
> CopyMemoryIP(lstr_host, lul_ptr, 16)
> // get memory address where ipaddress is located
> CopyMemoryIP(lul_ipaddr, lstr_host.h_addr_list, 4)
> // copy ipaddress to local blob
> lblb_ipaddr = Blob(Space(4),EncodingAnsi!)
> CopyMemoryIP(lblb_ipaddr, lul_ipaddr, 4)
> // convert blob to string ip address
> ls_ipaddress =
> String(AscA(String(BlobMid(lblb_ipaddr,1,1)
> ,EncodingAnsi!)),"##0") + "."
> ls_ipaddress +=
> String(AscA(String(BlobMid(lblb_ipaddr,2,1)
> ,EncodingAnsi!)),"##0") + "."
> ls_ipaddress +=
> String(AscA(String(BlobMid(lblb_ipaddr,3,1)
> ,EncodingAnsi!)),"##0") + "."
> ls_ipaddress +=
> String(AscA(String(BlobMid(lblb_ipaddr,4,1)
> ,EncodingAnsi!)),"##0") End If
>
> Return ls_ipaddress
>
> Hope that helps.
>
> Cheers
> --
> Andrew Giulinn
> Senior Analyst/Programmer
> Integrated Aviation Software Pty Ltd
>
> "Breck Carter [TeamSybase]"
> <NOSPAM__bcarter@risingroad.com> wrote in message
> > news:bgqee1hkmi3g2n94unp0k16jkhlthjg4mh@4ax.com... On 26
> > Jul 2005 18:22:38 -0700, "Andrew Giulinn"
> <NO.oscar.SPAM@dsa.com.au> wrote: >
> >>That just gives me the machine name, not the IP address.
> >>
> >>Does anyone know under what circumstances the "or IP
> address" part of the >>Help for "SELECT property (
> 'Machinename' )" kicks in? >>
> >>We use that select to get the server's machine name,
> then we use a Windows >>API to find out the IP address of
> the machine named as the server. If >>embedded SQL is a
> requirement for the OP that won't help, but I can give
> >>more details of the API call we use if needed. >>
> >>Cheers
> >>
> >>Andrew
> >
> > Yes, please, I would like to know about the API call
> > that works for you... thanks!
> >
> > Breck
> >
> > --
> > SQL Anywhere Studio 9 Developer's Guide
> > Buy the book:
> >
>
http://www.amazon.com/exec/obidos/ASIN/1556225067/risingroad-20
> > bcarter@risingroad.com
> > RisingRoad SQL Anywhere and MobiLink Professional
> > Services www.risingroad.com
>
>