Command line utility to create ODBC system data source to SQL

  • Does anyone know of a command line utility to create a system ODBC data source? I want to include it in a "installation program" that would be run as part of a effort to upsize a Access database on a file share to use linked tables to SQL Server.

  • I launch a *.reg file with the information in it.  Below is a sample for Windows 2000.   It adds in the name and the ODBC entry of a SQL Database.  I make my ODBC connections the same name as my database, but you do not have to.  I placed an* where it is optional to use the database name as the ODBC name.

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\database_name*]

    "Driver" = "C:\\WINNT\\System32\\SQLSRV32.dll"

    "Server" = "server1"

    "Database" = "database_name"

    "Trusted_Connection" = "Yes"

    [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources]

    "database_name*"="SQL Server"



    Michelle

  • There is a command line utility in the System32 directory called odbcconf.exe. Typing odbcconf /h in a command window will popup the utilities options. An example to create a system DSN for a SQL Server database would be:

    ODBCCONF CONFIGSYSDSN "SQL Server" "DSN=MyODBC | Description=My connection to my database | SERVER=MyServer | Database=MyDatabase"

    Kemp 

  • Found the ODBCCONF very helpful.  but can not find the parameter for SQL DSN to create it as a trusted connection ? 

  • To run the code described in the previous posts, does the user have to have administrative rights to their machine?



    Dana
    Connecticut, USA
    Dana

  • Here is the command that ended up working for me. I put it all on one line in bat file. I was even able to email it to a remote user and she ran it herself.  I ran it with admin rights, but I do not know if it was required.

    ODBCCONF.exe CONFIGSYSDSN "SQL Server" "DSN=dsGiftTracking | Description=Gift Tracking Data Source | SERVER=sqlserver01 | Trusted_Connection=Yes | Database=dbGiftTracking"

  • How would you code and ID and PW SQL server Authentication?

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply