Forum Stats

  • 3,784,355 Users
  • 2,254,928 Discussions
  • 7,880,790 Comments

Discussions

[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed

3204902
3204902 Member Posts: 4
edited Jul 3, 2018 9:54PM in ODBC

Hi,

We have a classic ASP web application talking to Oracle database. Currently we are migrating this application to a new server whose OS is Windows Server 2012 R2. On the new server, we have installed & configured Oracle client successfully. TNSping, sqlplus, ODBC Data Source Administrator are all working properly. However, we are still facing a database connection issue of below.

Code:

<%
Response.Write "<script>alert('Hello1');</script>"
set MyCon = server.createobject("ADODB.connection")
Response.Write "<script>alert('Hello2');</script>"
MyCon.open "DRIVER={Microsoft ODBC for Oracle};ConnectionString=TNSName;UID=Username;PWD=Password;"
Response.Write "<script>alert('Hello3');</script>"
%>

Error message:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed

/MSDS/test.asp, line 21

Hello1 & Hello2 popped up. But Hello3 didn't pop up. Do you have any ideas?

Thanks!

Answers

  • Thiyagu - Oracle
    Thiyagu - Oracle Member Posts: 30
    edited Jul 3, 2018 9:54PM

    Hi

    Since you are using Microsoft driver we can not provider any suggestions. So please use Oracle  ODBC driver

    Sample Code :

    Const oracle_user = "scott"
    Const oracle_password = "tiger"
    Const oracle_sid  = "ORCL12C2"
    Const odbc_driver_name = "{Oracle in OraClient12Home1_32bit}"

    Set DBConnection = CreateObject("ADODB.Connection")
    Set SQLCommand = CreateObject("ADODB.Command")

    DBConnection.Open "Driver=" & odbc_driver_name & "; " & _
                  "DBQ=" & oracle_sid & "; " & _
                  "UID=" & oracle_user & "; " & _
                  "PWD=" & oracle_password & ";"

    Set SQLCommand.ActiveConnection = DBConnection

    Thanks

    Thiyagu

This discussion has been closed.