ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Define OLEDB connection string (https://www.excelbanter.com/excel-programming/323451-define-oledb-connection-string.html)

john

Define OLEDB connection string
 
I am having trouble defining an OLEDB connection string to
an Oracle database. I have no problem using an ODBC
connection.

Works (ODBC)
obj.Connection = "ODBC;DRIVER={Microsoft ODBC for
Oracle};SERVER=IFAS;UID=scott;PWD=tiger"

Doesn't work (OLEDB)
obj.Connection = "OLEDB; Provider=MSDAORA; Data
Source=ifas; User ID=scott; Password=tiger;"

Does a DSN need to be created for OLEDB connections? What
am I missing? TIA...

John

Jake Marx[_3_]

Define OLEDB connection string
 
Hi John,

You should be able to do it DSN-less. The connection string should be:

"Provider=msdaora;Data Source=MyOracleDB;" & _
"User Id=myUsername;Password=myPassword"

I don't know if this slightly-different version will work for you or not.
Info from:

http://www.able-consulting.com/MDAC/...romMicr osoft

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


John wrote:
I am having trouble defining an OLEDB connection string to
an Oracle database. I have no problem using an ODBC
connection.

Works (ODBC)
obj.Connection = "ODBC;DRIVER={Microsoft ODBC for
Oracle};SERVER=IFAS;UID=scott;PWD=tiger"

Doesn't work (OLEDB)
obj.Connection = "OLEDB; Provider=MSDAORA; Data
Source=ifas; User ID=scott; Password=tiger;"

Does a DSN need to be created for OLEDB connections? What
am I missing? TIA...

John



Jamie Collins

Define OLEDB connection string
 

Jake Marx wrote:
You should be able to do it DSN-less. The connection string should

be:

"Provider=msdaora;Data Source=MyOracleDB;" & _
"User Id=myUsername;Password=myPassword"


I seem to remember Oracle's own OLEDB provider being preferred to
Microsoft's version.

The OP can roll their own OLEDB connection string using the following:

Sub ShowConnString()
Dim oDLink As Object
Set oDLink = CreateObject("DataLinks")
On Error Resume Next
MsgBox oDLink.PromptNew
End Sub

Jamie.

--


Jake Marx[_3_]

Define OLEDB connection string
 
Jamie Collins wrote:
"Provider=msdaora;Data Source=MyOracleDB;" & _
"User Id=myUsername;Password=myPassword"


I seem to remember Oracle's own OLEDB provider being preferred to
Microsoft's version.


Interesting - I remember hearing the opposite some time ago. But when I
google it now, I get conflicting results on which provider is better.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]



All times are GMT +1. The time now is 08:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com