I ran into problems running the Oracle-provided driver when using ADO. The workaround is to use the Microsoft ODBC for Oracle driver. Ensure it is the latest version from Microsoft.
Main Topics
Browse All TopicsI am working on a VB project which uses ADO to extract data from Oracle database. The problem is that the application would work only on a machine which has got Oracle client.
The work around is installing ODBC driver for oracle database connectivity.
Is it possible to package the driver with the application.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: michonfrPosted on 2001-09-18 at 05:47:12ID: 6490333
Not really.
ull, ODBC_ADD_DSN, _
ull, _
The best you can do is to add or remove a DSN (ODBC) entry from VB. If that's sufficient here's how:
Start a New Project.
In the Advanced tab of the Options dialog box under the Tools menu, set a Conditional Compilation Argument named WIN32 equal to 1 if using Visual Basic 4.0 32-bit, or 0 if using Visual Basic 4.0 16-bit.
Add two CommandButtons to the default form.
Add the following code to the General Declarations:
Option Explicit
'Constant Declaration
Private Const ODBC_ADD_DSN = 1 ' Add data source
Private Const ODBC_CONFIG_DSN = 2 ' Edit data source
Private Const ODBC_REMOVE_DSN = 3 ' Remove
Private Const vbAPINull As Long = 0&
'Function Declare
#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
Add the following code into the Click event of Command1:
#If WIN32 Then
Dim intRet As Long
#Else
Dim intRet As Integer
#End If
Dim strDriver As String
Dim strAttributes As String
'Set the driver to SQL Server because it is most common.
strDriver = "SQL Server"
'Set the attributes delimited by null.
'See driver documentation for a complete
'list of supported attributes.
strAttributes = "SERVER=SomeServer" & Chr$(0)
strAttributes = strAttributes & "DESC=Temp DSN" & Chr$(0)
strAttributes = strAttributes & "DSN=DSN_TEMP" & Chr$(0)
strAttributes = strAttributes & "DATABASE=pubs" & Chr$(0)
strAttributes = strAttributes & "UID=sa" & Chr$(0)
strAttributes = strAttributes & "PWD=" & Chr$(0)
'To show dialog, use Form1.Hwnd instead of vbAPINull.
intRet = SQLConfigDataSource(vbAPIN
strDriver, strAttributes)
If intRet Then
MsgBox "DSN Created"
Else
MsgBox "Create Failed"
End If
Add the following code into the Click event of Command2:
#If WIN32 Then
Dim intRet As Long
#Else
Dim intRet As Integer
#End If
Dim strDriver As String
Dim strAttributes As String
'Set the driver to SQL Server because most common.
strDriver = "SQL Server"
'Set the attributes delimited by null.
'See driver doc for a complete list of attributes.
strAttributes = "DSN=DSN_TEMP" & Chr$(0)
'To show dialog, use Form1.Hwnd instead of vbAPINull.
intRet = SQLConfigDataSource(vbAPIN
ODBC_REMOVE_DSN, _
strDriver, strAttributes)
If intRet Then
MsgBox "DSN Deleted"
Else
MsgBox "Delete Failed"
End If
Run the project.
Click Command1 to add a DSN named DSN_TEMP.
Click Command2 to remove the DSN named DSN_TEMP.
Bye!