cancel
Showing results for 
Search instead for 
Did you mean: 

dbExpress ASA 9 connection string with machine name

Former Member
4,198

I am using the dbexpasa.dll (7.1) to connect a Delphi 7 application to an ASA 9 network database. Unfortunately, there are multiple databases with the same service (HOST) and database name on the network. Although Sybase documentation seems to indicate that you can specify a physical server name or IP address in the LINKS parameter of the connection string, I have been unsuccessful at getting that to work. I have played around with the asasrv.ini file to control which physical server the connection hits, but that file seems to automatically be modified if that server is not available, so I never know for sure where the connection is going to go. Here is a connection string that works, but without specifying the physical server: HOSTNAME=<databaseservicename>,DATABASE=<databasename>,USER_NAME=<username>,PASSWORD=** I have tried to add LINKS=TCPIP(IP=10.10.xx.xx:2638) or LINKS=TCPIP(HOST=10.10.xx.xx:26338) to no avail. Is it possible to include the physical server name or is the only solution to rename the database services to be different?

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

Breck_Carter
Participant

As far as I can tell, HOSTNAME, DATABASE and USER_NAME are not the names of connection string parameters in SQL Anywhere 9... are they Delphi things, or just speling misteaks in your question?

The HOST keyword is an inner-level TCPIP protocol parameter, not an outer-level connection string parameter. HOST is the computer name or IP address... it is not the service name... I don't think the service name can be specified anywhere, but I may be wrong.

FWIW the asasrv.ini file is a cosmic-level annoyance, and has often been the cause of connections made to a server OTHER THAN the one specified in the connection string.

Here is an example of a connection string. In this case, the ddd.db database file has been started by dbsrv9.exe, causing both the runtime database name (DBN) and engine name (ENG) to default to "ddd". The HOST protocol option specifies the ip address for the computer running the database, plus the port :2638 being used , and the DOBROAD=NONE protocol option provides two benefits: It suppresses all the asasrv.ini foolishness, as well as all broadcasting to look for the database on other computers; in other words, if the HOST doesn't work the connection will fail, which is what you want (it's what EVERYBODY wants in my opinion):

"ENG=ddd;DBN=ddd;UID=dba;PWD=sql;LINKS=TCPIP(HOST=10.10.xx.xx:2638;DOBROAD=NONE)"

Generally speaking, in a network environment with any level of sophistication whatsoever, DOBROAD=NONE is your friend.

Former Member

Thanks for the input. With dbExpress - dbexpasa.dll - in Delphi 7 you do not have direct control of the connection string. You have to build it from connection parameters in the TSQLConnection object (hence the commas instead of semicolons as well as the spelling). Using DBN and ENG as params doesn't do anything. You have to use params DATABASE and HOSTNAME (the service name). It looks like Delphi is only interpreting certain params into the connection string. (Incidentally, the ADO connection object does allow direct access to a connection string, but not the dbExpress objects.) I have been researching this for months without any clear indication that you can or cannot specify a physical server name in the params from Delphi. It looks like the solution for us will be to change the database server (service) names to be different from each other. It probably should have been done that way from the start anyway.

Breck_Carter
Participant
0 Kudos

The dbsvc utility that ships with SQL Anywhere 9 may help you to semi-automate the service naming process.