Skip to Main Content

Oracle Database Express Edition (XE)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Old style OLEDB connection string?

504407Apr 20 2006 — edited Apr 21 2006
First, I would like to thank everyone who has so patiently helped me so far. Thank you.

I uninstalled all Oracle apps and items I had on my machine (XP), restarted and installed OracleXE using the default settings (with Administrator rights). I also worked through the getting started guide and created the MyApp HR application.

I also ran ODAC101040.exe to install the OLEDB drivers.
I went to c:\oraclexe\app\oracle\product\10.2.0\server\bin
and executed:
regoledb.bat c:\oraclexe\app\oracle\product\10.2.0\server
and to make sure it ran ok, I ran:
regsvr32 OraOLEDB10.dll
which succeeded.

So how would I connect to the HR info using OLEDB via VBScript? I tried the script below but I keep getting the error:

'Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC Driver Manager]
'Data source name not found and no default driver specified

(I cant use the NET provider because I am working on getting an existing C++ application using OLEDB to also support Oracle.)

Our application uses the Windows OLEDB Template library and when I tried it, it said "OraOLEDBpus10.dll: module not found". But you can fix this by adding the environment variable: ORACLE_HOME with value c:\oraclexe\app\oracle\product\10.2.0\server
and to the path appended: c:\oraclexe\app\oracle\product\10.2.0\server\bin

And then restart after doing anything with Oracle, even though the Oracle software never tells you to restart. Also after instaling because some service hang around otherwise.

Any help would be greatly appreciated.

(To try the script, paste the code below in a file, say "x.vbs" and run it from the Windows command line by typing "cscript x.vbs")

My test script is based on:
http://www.codeproject.com/useritems/orcale_without_tnsnames.asp?df=100&forumid=228106&exp=0&select=1264429
http://www.codeproject.com/database/connectionstrings.asp#OLE%20DB%20Oracle

And according to the above examples, the VBScript code below ought to work.

If I run "lsnrctl status" I do see the line:
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxxx.xxx.com)(PORT=1521)
))
_________________________________________________________________


Dim strCon

strCnn = "Provider=OraOLEDB.Oracle;User Id=hr;Password=hr;Data Source=USERS;"

'strCnn = "Provider=OraOLEDB.Oracle;User Id=hr;Password=hr;Data Source=XE;"
'
'
'strCnn = "Provider=OraOLEDB.Oracle;User Id=hr;Password=hr;" &_
' "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)" &_
' "(PORT=1521))(CONNECT_DATA=(SID=ORCL)));PLASQLRSet=1;" & _
' "ChunkSize=4096;DistribTx=0;"


'strCnn = "Provider=OraOLEDB.Oracle;User Id=hr;Password=hr;" &_
' "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)" &_
' "(PORT=1521))(CONNECT_DATA=(SID=USERS)));PLASQLRSet=1;" & _
' "ChunkSize=4096;DistribTx=0;"

'strCnn = "Provider=OraOLEDB.Oracle;User Id=hr;Password=hr;" &_
' "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)" &_
' "(PORT=1521))(CONNECT_DATA=(SID=XE)));PLASQLRSet=1;" & _
' "ChunkSize=4096;DistribTx=0;"

Dim oCon
Set oCon = WScript.CreateObject("ADODB.Connection")
Dim oRs
Set oRs = WScript.CreateObject("ADODB.Recordset")
oCon.Open strCon

Message was edited by:
user501404

Message was edited by:
user501404

Message was edited by:
user501404
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 19 2006
Added on Apr 20 2006
1 comment
513 views