Question

I am using BCP to export/import data sometimes to remote servers where i cannot login into the OS, only connect to the DB. I have success with using BCP to connect to a server like this:

bcp mytester.dbo.MyTable in MyTable.bcp -S Sybase157 -U sa -P SyAdmin -n

This of course only works becuase Sybase157 is defined in my sql.ini.

My question:

a) Is it possible to sidestep the whole sql.ini thing and just do something like -S mydb.server.com or -S 123.123.123.123

and if not....

b) what do i need to add to sql.ini in order to connect to a remote server?

Was it helpful?

Solution

The peices required for the sql.ini is the hostname(or ip) and port number of the remote server. You must have those two pieces of information at a minimum. You do not need to know the servername of the remote server.

Sybase recommends using the Open Client Directory Service Editor (dsedit) to make changes to the sql.ini file (or interfaces file on unix)

Start > Programs > Sybase Connectivity > Open Client Directory Service Editor

As long as the hostname(or ip) and port are correct, you can choose any valid name for the server you want. This will become the the servername, e.g. -S theNameYouUsedInSqlIni.

This does not change the remote server's servername, or affect the remote server in any way, it only affects connections from your local system.

Adding a Server to the Interfaces File

It's also possible to use LDAP if that is an option in your environment:

Configuring libctl.cfg for LDAP/Using a Directory Service

OTHER TIPS

Anawer for (b) : Copy the content of remote server's sql.ini and paste it in your client's sql.ini file. By doing this you will have remote server details in your client's file. You can then do bcp to the remote server using the same command :

bcp mytester.dbo.MyTable in MyTable.bcp -S <remote_host_name> -U sa -P SyAdmin -n

Not clear aboout the question (a) you have to use -U, -P parameters as well only specifying Server won't be enough

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top