[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Oracle ODBC Configuration From VB5

Posted on 1998-07-24
3
Medium Priority
?
695 Views
Last Modified: 2008-02-01
HELP!,

I am trying to automatically configure the Oracle ODBC data source from Visual Basic5.  I can set up a basic data source but cannot find the syntax required to load the SQl*Net Connect String.  I am currently using the following code
'Decalrations Used to Generate EUP DSN
Private Const ODBC_ADD_DSN = 1 ' Add data source
Private Const ODBC_CONFIG_DSN = 2 ' Configure (edit) data source
Private Const ODBC_REMOVE_DSN = 3 ' Remove data source
Private Const vbAPINull As Long = 0& ' NULL Pointer
#If Win32 Then
    Private Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL" _
    (ByVal hwndParent As Long, ByVal fRequest As Long, _
     ByVal lpszDriver As String, ByVal lpszAttributes As String) _
     As Long
#Else
     Private Declare Function SQLConfigDataSource Lib "ODBCINST.DLL" _
     (ByVal hwndParent As Integer, ByVal fRequest As Integer, ByVal _
     lpszDriver As String, ByVal lpszAttributes As String) As Integer
#End If

    #If Win32 Then
        Dim intRet As Long
    #Else
        Dim intRet As Integer
    #End If
    Dim strDriver As String
    Dim strAttributes As String

   strDriver = "Oracle73 Ver 2.5"
    strAttributes = "SQL*Net Connect String=EUP" & Chr$(0)
    strAttributes = strAttributes & "DESCRIPTION=Europa Connection (EUP)" & Chr$(0)
    strAttributes = strAttributes & "DSN=EUP" & Chr$(0)
   
    intRet = SQLConfigDataSource(vbAPINull, ODBC_ADD_DSN, _
             strDriver, strAttributes)
0
Comment
Question by:WHITER
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
waty earned 300 total points
ID: 1080796
Try this, it works on my computer

Public Sub CreateDSN()

   Dim intRet        As Long
   Dim strDriver     As String
   Dim strAttributes As String
   
   strDriver = "Oracle73 Ver 2.5"
   strAttributes = "Server=EUP" & Chr$(0)
   strAttributes = strAttributes & "DESCRIPTION=Europa Connection (EUP)" & Chr$(0)
   strAttributes = strAttributes & "DSN=EUP" & Chr$(0)
   
   intRet = SQLConfigDataSource(vbAPINull, ODBC_ADD_DSN, strDriver, strAttributes)

End Sub



0
 

Author Comment

by:WHITER
ID: 1080797
I Thought I'd already tried this........Well done it worked fine.

Thanks for your help.

0
 
LVL 14

Expert Comment

by:waty
ID: 1080798
You know, you could also use the following code and it works too, but without any API

Public Sub CreateDSN(sDSN As String)

   Dim nRet                As Long
   Dim sDriver             As String
   Dim sAttributes         As String
   
   
   strDriver = "Oracle73 Ver 2.5"
   strAttributes = "Server=EUP" & Chr$(0)
   strAttributes = strAttributes & "DESCRIPTION=Europa Connection (EUP)" & Chr$(0)
   strAttributes = strAttributes & "DSN=EUP" & Chr$(0)
   
   DBEngine.RegisterDatabase sDSN, strDriver, True, strAttributes
   
End Sub

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question