cancel
Showing results for 
Search instead for 
Did you mean: 

dbping vs. dblocate

Former Member
4,667

Can someone tell me why dblocate finds the SQL Anywhere network server running on my TCP/IP network, but dbping does not find it? The server is running on the default port, firewalls are disabled on client and server, and I call dbping or dblocate from the client computer without any switches. If it makes a difference, the dbping and dblocate programs are a slightly older version, 10.0.1.3976, than the server, 10.0.1.4051.

Accepted Solutions (1)

Accepted Solutions (1)

MarkCulp
Participant

dbping and dblocate are quite different applications but may under the cover use similar but functionally different mechanisms to find a server.

dblocate uses UDP broadcasts to the local network(s) to attempt to find all SQL Anywhere database servers. When each SA server receives the broadcast message, they each respond with a directed UDP response packet back to the sender to report its IP address and port number that can be used to connect to the server. Note that the port on which the server is listening for UDP broadcasts can be different than the port on which it will accept TCP connection - this happens in the case that you have specified a different port (than 2638) when you started the server. E.g. If you specified: "dbsrvX -x tcpip{port=1234}" then the server will listen for UDP broadcasts on both port 2638 and 1234 but will only listen for TCP connections on port 1234. Note also that a server will not respond to the UDP broadcast if it was started with "-sb 0" switch. i.e. "stealth mode".

dbping is really just a normal client application that you or I could write. It uses the connection string that has been given to it and/or uses SQLCONNECT environment variable value to attempt to make a connection to an SA server and database running on that server. If no connection string is given and no SQLCONNECT value is set then dbping, like any other db client application, will attempt to connect to the default database running on the default server on the same computer (as dbping) using a shared memory connection. Additional options can be given to dbping to cause it to report one or more properties of the server/database once the connection has been made.

I should also note that dbping, like all client applications, may use a UDP broadcast in some circumstances to find the named server that you specified in the connection string. E.g. if you give the connection string "-c servername=myserver;links=tcpip" then under the covers the client db library will send a UDP broadcast to the local network(s) to find the named server "myserver". In this case only the server that is named "myserver" will respond back to the client to say where it is (ip address and port number). The difference between this broadcast and the one used by dblocate is that the presence of the name of the server that is trying to be found.

So as you can see dblocate is a specialize applications that can be used to find any server that exists on the local network without knowing the name(s) whereas dbping, like all client applications, is a generic client application and must know the name of the server (under normal circumstances - i.e. there are some exceptions to this rule) in order to find and connect to the server.

graeme_perrow
Advisor
Advisor

Note that dblocate is also just a client application - it uses the db_locate_servers_ex function in dblibX.dll to get all the server names. Using this function, you could write your own version of dblocate with identical functionality - we've just done it for you.

VolkerBarth
Contributor
0 Kudos

@Graeme: That's just fitting to your mission statement "We do the hard part", isn't it:)

Answers (1)

Answers (1)

VolkerBarth
Contributor

AFAIK, DBPING needs a connection string (specified with option -c).

If no connection string is given (as in your case), then the value of the environment variable SQLCONNECT is used. When SQLCONNECT is not filled, and you don't specify a connection string, then a "Server nor found" message is expected.

So there's obviously a difference in the usage of DBPING and DBLOCATE:)


According to Mark's much better explanation, I should add:

In case of a missing connection string and an empty/missing SQLCONNECT variable, the search for the default server/database on the local machine takes place - so even then you could find a server.