locked
My .vbs is Unable to connect to Access RRS feed

  • Question

  • User2022518256 posted

    Hello,

    I am attempting to have a .vbs file on the server connect to an Access database on that same server. I use the same connection script in my classic .asp pages and it works fine. But when I click on the .vbs file (on the server), I get this:

    Script:
    C:\website\myvbsfile.vbs
    Line: 42 
    [Microsoft][ODBC Driver Manager]Data Source Name not found and no default driver specified 
    Code: 80004005 Source: Microsoft OLE DB Provider for ODBC Drivers

    'here is the connection vbscript in the .vbs file:Dim objConn

    Set objConn = CreateObject("ADODB.Connection")
    objConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
        "DBQ=c:/databases/mydb.mdb"  

    objConn.Open 'line 42

    My Settings:
    Enable 32-bit Applications is set to True. I would like to attempt to connect with a system DSN, but the System DSN tab of the ODBC Data Source Administrator shows no system data sources. If I click the Add button, the Create New Data Source dialog only shows a SQL Server driver. The Drivers tab shows only the SQL Server Driver. However, the USER DSN tab DOES show the Microsoft Access Driver.

    Any Ideas?

    Wednesday, January 7, 2009 8:11 PM

Answers

  • User930989739 posted

    Start 32 bit command prompt (%windir%\system32\cmd.exe) or explicitly call 32bit cscript (%windir%\syswow64\cscript.exe)to launch your script. That should (hopefully) take care of your issue

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, January 8, 2009 2:48 AM
  • User2022518256 posted

    Thank you, very helpful. With your input we solved the problem and connected the .vbs file to our Access DB. I'm new to this (.vbs and IIS7) so I may have it wrong, but here is our solution for anyone who may be reading: 

    We put the following script into a batch (.bat) file (a text file with the extension changed from .txt to .bat):

    C:\WINDOWS\SysWOW64\wscript.exe "C:\websites\mysite\myvbsfile.vbs"

    As far as I understand, this tells the system to use the 32-bit driver. Instead of clicking on the myvbsfile.vbs file directly, I now run the batch file and IT runs the .vbs file.

    Thanks again.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, January 16, 2009 6:49 PM

All replies

  • User930989739 posted

    Start 32 bit command prompt (%windir%\system32\cmd.exe) or explicitly call 32bit cscript (%windir%\syswow64\cscript.exe)to launch your script. That should (hopefully) take care of your issue

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, January 8, 2009 2:48 AM
  • User2022518256 posted

    Thank you, very helpful. With your input we solved the problem and connected the .vbs file to our Access DB. I'm new to this (.vbs and IIS7) so I may have it wrong, but here is our solution for anyone who may be reading: 

    We put the following script into a batch (.bat) file (a text file with the extension changed from .txt to .bat):

    C:\WINDOWS\SysWOW64\wscript.exe "C:\websites\mysite\myvbsfile.vbs"

    As far as I understand, this tells the system to use the 32-bit driver. Instead of clicking on the myvbsfile.vbs file directly, I now run the batch file and IT runs the .vbs file.

    Thanks again.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, January 16, 2009 6:49 PM