1

I need to create a number of ODBC connections to a MS SQL Server, the clients are mainly XP machines. The connection has to use SQL server authentication - is there a way to do this remotely via command line? I think that this type of authentication may be a stumbling block? Any advice on automating or part automating this type of task would be really appreciated.

Thanks,

Joe

aphrek
  • 23
  • 1
  • 2
  • 4
  • IIRC (not sure, so just a comment), you can create the connections, but you won't be able to specify the password this way. – Joel Coel Mar 12 '13 at 16:54
  • I don't understand the "remotely via command line" bit. Are you saying you want to connect to a machine and use cmd.exe to create a text file that contains an ODBC connection string? – Hannah Vernon Mar 12 '13 at 17:07
  • Hi, I basically want to automate the creation of the odbc connection across multiple machines - I assumed command line would be the way to do this - but I'm not sure if it's possible to get around the SQL authentication issue.. – aphrek Mar 12 '13 at 17:27
  • Glad the answer worked for you. Please indicate it was the answer. – shiitake Mar 28 '13 at 22:00

1 Answers1

1

The SQLCMD utility will probably be your best option. From what you've indicated it meets all of the requirements above: command-line, ODBC driver, SQL Authentication. The basic syntax would be something like:

sqlcmd -S <servername> -U <login>

see: sqlcmd Utility

This should work fine in Windows XP but unless you've got SQL already installed on the client machines you will need to manually install SQLCMD and the SQL Native Client. Downloads for distributable packages for both of these can be found here.

shiitake
  • 379
  • 1
  • 7