Manually Creating an ODBC DSN Entry

Creating USER DSN via Registry:

[HKEY_CURRENT_USERSoftwareODBCODBC.INITEST-SQL-ODBC]
"Driver"="C:\Windows\SysWOW64\sqlncli.dll"
"Description"="TEST-SQL-ODBC"
"Server"="SERVER01\SQLINSTANCE01"
"Database"="TrackAsset"
"LastUser"="sa"

[HKEY_CURRENT_USERSoftwareODBCODBC.INIODBC Data Sources]
"TEST-SQL-ODBC"="SQL Native Client"

Verifying the creation by registry query:

C:>reg query "HKEY_CURRENT_USERSoftwareODBCODBC.INITEST-SQL-ODBC"

HKEY_CURRENT_USERSoftwareODBCODBC.INITEST-SQL-ODBC
    Driver    REG_SZ    C:WindowsSysWOW64sqlncli.dll
    Description    REG_SZ    TEST-SQL-ODBC
    Server    REG_SZ    SERVER01SQLINSTANCE01
    Database    REG_SZ    TrackAsset
    LastUser    REG_SZ    sa1

C:>reg query "HKEY_CURRENT_USERSoftwareODBCODBC.INIODBC Data Sources" /v "TEST-SQL-ODBC"

HKEY_CURRENT_USERSoftwareODBCODBC.INIODBC Data Sources
    TEST-SQL-ODBC    REG_SZ    SQL Native Client

C:>

 

Creating 32-bit SYSTEM DSN via Registry:

[HKEY_LOCAL_MACHINESOFTWAREWow6432NodeODBCODBC.INITEST-SQL-ODBC]
"Driver"="C:\Windows\SysWOW64\sqlncli.dll"
"Description"="TEST-SQL-ODBC"
"Server"="SERVER01\SQLINSTANCE01"
"Database"="TrackAsset"
"LastUser"="sa"

[HKEY_LOCAL_MACHINESOFTWAREWow6432NodeODBCODBC.INIODBC Data Sources]
"TEST-SQL-ODBC"="SQL Native Client"

Verifying the creation by registry query:

C:>reg query "HKEY_LOCAL_MACHINESOFTWAREWow6432NodeODBCODBC.INITEST-SQL-ODBC"

HKEY_LOCAL_MACHINESOFTWAREWow6432NodeODBCODBC.INITEST-SQL-ODBC
    Driver    REG_SZ    C:WindowsSysWOW64sqlncli.dll
    Description    REG_SZ    TEST-SQL-ODBC
    Server    REG_SZ    SSERVER01SQLINSTANCE01
    Database    REG_SZ    TrackAsset
    LastUser    REG_SZ    sa

C:>reg query "HKEY_LOCAL_MACHINESOFTWAREWow6432NodeODBCODBC.INIODBC Data Sources" /v "TEST-SQL-ODBC"

HKEY_LOCAL_MACHINESOFTWAREWow6432NodeODBCODBC.INIODBC Data Sources
    TEST-SQL-ODBC    REG_SZ    SQL Native Client

C:>

Creating 64-bit SYSTEM DSN via Registry:

[HKEY_LOCAL_MACHINESOFTWAREODBCODBC.INITEST-SQL-ODBC]
"Driver"="C:\Windows\system32\sqlncli.dll"
"Description"="TEST-SQL-ODBC"
"Server"="SERVER01\SQLINSTANCE01"
"Database"="TrackAsset"
"LastUser"="sa"

[HKEY_LOCAL_MACHINESOFTWAREODBCODBC.INIODBC Data Sources]
"TEST-SQL-ODBC"="SQL Native Client"

Verifying the creation by registry query:

C:>reg query "HKEY_LOCAL_MACHINESOFTWAREODBCODBC.INITEST-SQL-ODBC"

HKEY_LOCAL_MACHINESOFTWAREODBCODBC.INITEST-SQL-ODBC
    Driver    REG_SZ    C:Windowssystem32sqlncli.dll
    Description    REG_SZ    TEST-SQL-ODBC
    Server    REG_SZ    SSERVER01SQLINSTANCE01
    Database    REG_SZ    TrackAsset
    LastUser    REG_SZ    sa

C:>reg query "HKEY_LOCAL_MACHINESOFTWAREODBCODBC.INIODBC Data Sources" /v "TEST-SQL-ODBC"

HKEY_LOCAL_MACHINESOFTWAREODBCODBC.INIODBC Data Sources
    TEST-SQL-ODBC    REG_SZ    SQL Native Client

C:>

Important Notes:

  1. You can create separate System and User DSN’s with same name
  2. You can have separate System DSN’s for both 32-bit and 64-bit type with same name
  3. You can only have only one USER DSN per user with same name (there is no 32-bit/64-bit DSN of USER type)

0 thoughts on “Manually Creating an ODBC DSN Entry

Leave a Reply

Your email address will not be published. Required fields are marked *