Server.CreateObject ("ADODB.Command") activeConnection gives server error

I'm trying to set up an old website on my local windows 10 machine!
I've setup IIS and added the classic ASP module and If I use non database ASP pages
it works fine.  I've installed MySQL and setup ODBC with the proper driver and can access and test
the database fine!  
Its when I try access the database via ASP that it fails! The code I'm using worked fine on the web server.

This is the code that gives the error!
   
     Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
     Recordset1_cmd.ActiveConnection = "DSN=netcode;UID=peter;PSW=1234;"    *** This is the line that fails ***

I've also modified the read/write permissions on the INETPUB folder and all subfolders to full control!
And have modifier the users to full control as well!  

thanks

Pete
Peter GrovesAsked:
Who is Participating?
 
Peter GrovesAuthor Commented:
The ODBC connects fine and I've fixed the error! The problem was in the IIS configuration , I had to enable the allow 32bit apps to run!

I had to go to IIS application tools , click on Default appPool and check the enable 32bit applications!  

I also had to run in DNS-less mode!   "DRIVER={MySQL ODBC 5.3 ANSI Driver}; Server=127.0.0.1;Database=prestige;User=user1;Password=1234; OPTION=3"

I know this ASP classic is ancient now but I just needed to get a report printed!

Thanks

Pete
1
 
Sam Simon NasserIT Support ProfessionalCommented:
did you installed mysql odbc connector?
https://dev.mysql.com/downloads/connector/odbc/5.1.html
0
 
Peter GrovesAuthor Commented:
Yes its installed and the test is successful!  As an added test I opened Access and connected to the ODBC connector without a hitch!

Pete
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
Did you set up your ODBC connection in the 32 bit ODBC module and NOT the 64 but one?
0
 
Peter GrovesAuthor Commented:
Yes the 32bit!   There are 2 of them the ANSI and the unicode and I tried both.  
MySQL ODBC 5.3 ANSI Driver 32bit and
MySQL ODBC 5.3 Unicode Driver 32bit

I'll try set up an MSSQL db to test the connection!

Pete
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
0
 
Peter GrovesAuthor Commented:
error '80004005'  but apparently its just a generic error code!  

here is the error from the IIS logs.
---------------------------------------------------
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2018-04-05 20:41:48
#Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
2018-04-05 20:42:30 W3SVC1 DESKTOP-R2TR180 127.0.0.1 GET /getload.asp |10|80004005|- 80 - 127.0.0.1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:59.0)+Gecko/20100101+Firefox/59.0 http://127.0.0.1/main.html 500 0 0 316 712 6
2018-04-05 20:42:43 W3SVC1 DESKTOP-R2TR180 127.0.0.1 GET /getload.asp |10|80004005|- 80 - 127.0.0.1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/58.0.3029.110+Safari/537.36+Edge/16.16299 - 500 0 0 383 327 0
2018-04-05 20:43:22 W3SVC1 DESKTOP-R2TR180 127.0.0.1 GET /main.html - 80 - 127.0.0.1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/58.0.3029.110+Safari/537.36+Edge/16.16299 - 200 0 0 1829 380 0
2018-04-05 20:43:22 W3SVC1 DESKTOP-R2TR180 127.0.0.1 GET /netricom.png - 80 - 127.0.0.1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/58.0.3029.110+Safari/537.36+Edge/16.16299 http://127.0.0.1/main.html 200 0 0 5223 433 0
2018-04-05 20:43:22 W3SVC1 DESKTOP-R2TR180 127.0.0.1 GET /SpryAssets/SpryMenuBarDownHover.gif - 80 - 127.0.0.1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/58.0.3029.110+Safari/537.36+Edge/16.16299 http://127.0.0.1/main.html 200 0 0 279 456 0
2018-04-05 20:43:22 W3SVC1 DESKTOP-R2TR180 127.0.0.1 GET /SpryAssets/SpryMenuBarRightHover.gif - 80 - 127.0.0.1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/58.0.3029.110+Safari/537.36+Edge/16.16299 http://127.0.0.1/main.html 200 0 0 279 457 0
2018-04-05 20:43:22 W3SVC1 DESKTOP-R2TR180 127.0.0.1 GET /SpryAssets/SpryMenuBarRight.gif - 80 - 127.0.0.1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/58.0.3029.110+Safari/537.36+Edge/16.16299 http://127.0.0.1/main.html 200 0 0 279 452 1
2018-04-05 20:43:22 W3SVC1 DESKTOP-R2TR180 127.0.0.1 GET /SpryAssets/SpryMenuBarDown.gif - 80 - 127.0.0.1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/58.0.3029.110+Safari/537.36+Edge/16.16299 http://127.0.0.1/main.html 200 0 0 279 451 2

---------------------------------------------------
Logs don't show much!

Pete
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
all that info in your log, yet it says very little :)

Are you able to successfully connect via the ODBC (32-bit) manager? Do you have identical names on both 32-bit and 64-bit? if so, try renaming (or removing) the 64-bit name, as that could potentially cause a conflict.

You may also get more info if you write some debugging info to the screen using on error resume next:

on error resume next
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = "DSN=netcode;UID=peter;PSW=1234;"

if Err.Number <> 0 then
     Response.Write "Error: " & Err.Description
else
     Response.Write "No Error, yaaaaaay!"
end if

Response.End

Open in new window

0
 
Peter GrovesAuthor Commented:
Error description shows blank so I switched it to show the number!

 Error: -2147467259

Pete
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
and are you able to connect in the ODBC wizard?
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
I was going to suggest DSN-less.  I have never used a DSN and I remember old articles about security.  I found this recent one https://blogs.office.com/en-us/2011/04/08/power-tip-improve-the-security-of-database-connections/
0
 
Peter GrovesAuthor Commented:
thanks all
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.