Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Dec 2002
    Location
    Pleasanton, USA
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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).

  2. #2
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Minneapolis, Minnesota, USA
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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.<pre>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
    </pre>

    <font face="Comic Sans MS"><font color=blue>~Shane</font color=blue></font face=comic>

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

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

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •