[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference orarep::nomahs::odbc_rdb_driver

Title:DEC ODBC Driver
Notice:DEC ODBC Driver V2.0 Now Available
Moderator:SQLSRV::MAVRIS
Created:Tue Dec 29 1992
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1357
Total number of notes:4864

1332.0. "adding datasource programmatically dll and attributes" by M5::JHAYTER () Wed Apr 16 1997 17:10

Hi,

Since I have not progressed (degressed) to ODBC application programming,
please excuse my "duh".  Just checking to see if I have the answers.

Got a customer who wants to add datasources programmically, via the "configDSN"
function.

He needs to know what DLL this "configDSN" is in so "installshield" can
find it and do whatever that thing does.  The ODBC programmer's ref manual
makes a good hint it is supposed to be supplied by the driver setup dll.

If i read things right in the online help, sqrdbs.dll is our "setup dll" so
that is what he is looking for - correct?


Also, needs to know what are the attributes used in the call, in particuliar
the lpszattributes which are keyword/value pairs that apparently describes
the datasource.  I found in the online help some keywords under "format of
the connection string" that I think is what he is looking for - again,
correct?

thanks,
jerry

T.RTitleUserPersonal
Name
DateLines
1332.1ORAREP::EVTSG8::TOWERSThu Apr 17 1997 07:4829
    Here is an example code extract using VB4:
    Note that layout may be affected by the cut and paste.
    
    Declare Function SQLConfigDataSource Lib "odbccp32.dll" _
      (ByVal hwnd As Integer, ByVal fRefresh As Integer, ByVal szDriver As
       String, _
       ByVal szAttributes As String) As Integer
    
        strDriver = "Oracle ODBC Driver for Rdb" & Chr(0)
        strAttributes = "Description=NSQT Database" & Chr(0) & _
          "Schema=attach 'filename " & txtAttach & "NSQT'" & Chr(0) & _
          "User=" & strUserName & Chr(0) & _
          "Server=" & txtServerName & Chr(0) & "Options=0" & Chr(0) & _
          "Transport=2=tcp/ip" & Chr(0) & "Class=generic" & Chr(0) & _
          "Attributes=" & Chr(0) & "Cursor Option=1=NOHOLD" & Chr(0) & _
          "Driver=C:\WINDOWS\SYSTEM\SQRDB32.DLL" & Chr(0) & _
          "DSN=NSQT_RDB" & Chr(0) & "Options=0" & Chr(0)
        iRegAdd = SQLConfigDataSource(0, ODBC_ADD_DSN, strDriver,
          strAttributes)
    
    Note first, that this sort of thing is described in the MSDN. Any group
    doing serious Windows/MS development is foolish if they do not
    subscribe to the MSDN because the wealth of information is so great.
    
    Note second, that the above extract is for ODBC v2.5. It will probably
    still work for v3.0 but I'm sure the correct syntax has changed.
    
    Cheers,
    Brian
1332.2M5::JHAYTERThu Apr 17 1997 15:1513
Brian,

WOW, what a screen full...

Thanks,

From what I see in your example, this whole business looks like it is all
in the hands of MS dll's, not any of the dll's the "driver" provides.
My customer was wanting to call ConfigDSN, which is called by the
SQLConfigDataSource function you use.  Whatever....

Thanks,
Jerry