Skip to Main Content

Oracle Database Discussions

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!

Unable to connect to Oracle 10g thourgh VBA code

961366Sep 11 2012 — edited Sep 11 2012
Dear All,

I am unable to connect to the oracle database, am using the below code for the same.
And server name is PRDCCB, my TNSNAMES.ORA file is placed properly, and environment variable path set done.
ADO objects libry created in VBA.
But still am not able to connect error is Driver's SQLSETConnectAttr Failed

PLease help



Sub Ora_Connection()

Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Dim query As String
Set con = New ADODB.Connection
Set rs = New ADODB.Recordset


'---- Replace below highlighted names with the corresponding values

con.Open ("Driver={Microsoft ODBC for Oracle}; " & _
"CCBPRD=DESCRIPTION=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST= 10.1.3.50)(PORT=1521))" & _
"(CONNECT_DATA=(SID=CCBPRD))); uid=Prasad; pwd=prasad23;")

'--- Open the above connection string.


'--- Now connection is open and you can use queries to execute them.
'--- It will be open till you close the connection
End Sub
This post has been answered by Ahmer M on Sep 11 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 9 2012
Added on Sep 11 2012
4 comments
3,320 views