• How to create a System DSN w/o ODBC Data Admin (Win2K/Access 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » How to create a System DSN w/o ODBC Data Admin (Win2K/Access 2000)

    Author
    Topic
    #383036

    I would like to create System DSN to an Access DB without using the ODBC Datasource Administration utility. I created a System DSN, and then a User DSN. I searched the registry, and found both, with identical keys and values.

    Does anyone know what the effective distinction between these two DSN specifications is? There must be some other place where this information is stored (identifying one as a User DSN and the other as a System DSN).

    Viewing 1 reply thread
    Author
    Replies
    • #651628

      Hmmmm…I don’t know exactly how in the list of values the O/S determines whether it’s a System or User DSN. I do know that the following text, pasted into a file with a .vbs extension, will create a System DSN for a SQL Server connection named MyDSN on a Windows 2000 and XP box, though.

      Dim oWshShell
      Const cRegKey1 = "HKLMSoftwareODBCODBC.INIMyDSN"
      Const cRegKey2 = "HKLMSoftwareODBCODBC.INIODBC Data Sources"
      
      Set oWshShell = CreateObject ("WScript.Shell")
      
      oWshShell.RegWrite cRegKey1 & "Driver","C:WINNTSystem32sqlsrv32.dll"
      oWshShell.RegWrite cRegKey1 & "Server","Insert name of SQL Server here"
      oWshShell.RegWrite cRegKey1 & "Database","Insert database name here"
      oWshShell.RegWrite cRegKey1 & "Description","The text description you see in snap-in"
      oWshShell.RegWrite cRegKey1 & "Trusted_Connection","Yes"
      
      oWshShell.RegWrite cRegKey2 & "MyDSN","SQL Server"
      
      set oWshShell = Nothing 
      
    • #652167

      User DSN’s are in HKEY_CURRENT_USER, so they are only available to that user (and on a network with roaming profiles, it will be available to that user on any PC in the network).

      System DSN’s are in HKEY_LOCAL_MACHINE, so they are available to all users on that PC.

      In both cases, they can be found under SoftwareODBCODBC.INI.

    Viewing 1 reply thread
    Reply To: How to create a System DSN w/o ODBC Data Admin (Win2K/Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: