Skip to Main Content

DevOps, CI/CD and Automation

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!

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

3204902Jul 3 2018 — edited Jul 3 2018

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!

Comments

561093
create or replace function ean_13(P_Str In Varchar2) Return Varchar2 Is
l_Sum Number;
l_Multiple Number;
Begin
For I in 1..12 Loop
If mod(i,2) = 0 Then
l_Multiple := 3;
Else
l_Multiple := 1;
End If;

l_Sum := Nvl(l_Sum, 0) + Substr(P_Str, i, 1) * l_Multiple;
End Loop;
If Floor(l_Sum/10) - Mod(l_Sum, 10) = Substr(P_Str, 13) Then
Return('TRUE');
Else
Return('FALSE');
End If;
End;
/


SQL> select ean_13('2741023456884') from dual;

EAN_13('2741023456884')
-------------------------------------------------------
TRUE

SQL> select ean_13('2741023456881') from dual;

EAN_13('2741023456881')
-------------------------------------------------------
FALSE
547235
Thanks for you prompt response,

why it does not work for the following:
2741012605644
2741012605651
2741000000017
it returns false.
561093
create or replace function ean_13(P_Str In Varchar2) Return Varchar2 Is
l_Sum Number;
l_Multiple Number;
Begin
For I in 1..12 Loop
If mod(i,2) = 0 Then
l_Multiple := 3;
Else
l_Multiple := 1;
End If;

l_Sum := Nvl(l_Sum, 0) + Substr(P_Str, i, 1) * l_Multiple;
End Loop;

If 10 - Mod(l_Sum, 10) = Substr(P_Str, 13) Then
Return('TRUE');
Else
Return('FALSE');
End If;
End;
/


SQL> select ean_13('2741012605644') from dual;

EAN_13('2741012605644')
------------------------------------------------
TRUE


SQL> select ean_13('2741012605651') from dual;

EAN_13('2741012605651')
--------------------------------------------------
TRUE


SQL> select ean_13('2741000000017') from dual;

EAN_13('2741000000017')
------------------------------------------------
TRUE
547235
THANKS BUDDY...YOU SAVED MY DAY
547235
HI CITRUS,

DO YOU HAVE THE OUTPUT PROCEDURE FOR GENERATING TEXT FILE FOR THE AIRMILES PROGRAMME

THANKS.
572471
SQL> with t as (select '2741023456884' str from dual)
  2  --
  3  select decode(substr(10 - mod(sum(substr(str, level, 1) *
  4                             decode(mod(level, 2), 1, 1, 3)),
  5                         10),-1,1),
  6                substr(str, -1, 1),
  7                'TRUE',
  8                'FALSE')
  9    from t
 10  connect by level < length(str)
 11  /

DECODE(SUBSTR(10-MOD(SUM(SUBST
------------------------------
TRUE

SQL> 
547235
thanks volder
1 - 7
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jul 31 2018
Added on Jul 3 2018
1 comment
6,352 views