ODBS System DSN RRS feed

  • Question

  • I tried to add DSN files and it will let me go through the motions of naming it, selecting the drivers, etc. and finish.  It does not give me any errors, but it does not add it either because I cannot see it in the list after adding it.  Any help would be greatly appreciated.
    Friday, June 22, 2007 1:56 PM

All replies

  • What kind of DSN are you attempting to create? User, System or File?
    Friday, June 22, 2007 2:24 PM
  • Hi there, I'm getting the same problem on 2003 servers.

    Have you found a fix? I have tried re-installing the MDAC but that didnt work.


    Any ideas? anyone?

    Monday, June 25, 2007 10:00 AM
  • System
    Monday, June 25, 2007 2:42 PM

  • For which type of database or driver? I want to see if you can do this through code.
    Monday, June 25, 2007 4:39 PM
  • Byers dBase Driver (*.dbf)
    Monday, June 25, 2007 4:42 PM

  • Don't think I've ever heard of the vendor. Do you have an example of the connection string?

    Also, can you create a System DSN for any other drivers?

    Monday, June 25, 2007 5:16 PM
  • I used the ODBC Administrator to add.


    I run into the same problem when trying to create a System DSN for any other drivers.  I tested with Microsoft ODBC for Oracle.

    Monday, June 25, 2007 5:54 PM

    Try running the following code to see if you can add it programmatically:


    Code Snippet

    Private Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL" (ByVal hwndParent As Integer, ByVal ByValfRequest As Integer, ByVal lpszDriver As String, ByVal lpszAttributes As String) As Integer

    Private Const ODBC_ADD_SYS_DSN As Short = 4

    Private Const vbAPINull As Integer = 0 ' NULL Pointer


    Public Sub CreatedBaseSystemDSN()


    Dim ReturnValue As Integer

    Dim Driver As String

    Dim Attributes As String

    Driver = "Byers dBase Driver (*.dbf)"

    Attributes = "DESCRIPTION=dBase DSN" & Chr(0)

    Attributes = Attributes & "DSN=MydBase" & Chr(0)

    Attributes = Attributes & "DATABASE=C:\path_to_dBase_files" & Chr(0)

    ReturnValue = SQLConfigDataSource(vbAPINull, ODBC_ADD_SYS_DSN, Driver, Attributes)

    If ReturnValue <> 0 Then

       MsgBox("DSN Created")


       MsgBox("Create Failed")

    End If


    End Sub


    Tuesday, June 26, 2007 12:30 PM
  • Thank you  Paul.  I've tried it and modified it and tried everything I can.  I am giving up and starting all over.  Thanks for all your help.
    Saturday, July 7, 2007 5:29 PM
  • I am having the same problem, a create the dsn but it does not get listed, no erros occur. System SQL Server dsn.


    I cannot reinstall my server, its a production server. Please need help urgently.

    Monday, July 9, 2007 8:41 PM