[Microsoft] [ODBC驱动程序管理器]找不到数据源名称且未指定默认驱动程序:奇怪的问题 [英] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified : Wierd issue

查看:794
本文介绍了[Microsoft] [ODBC驱动程序管理器]找不到数据源名称且未指定默认驱动程序:奇怪的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个.vbs文件,在该文件中,我使用下面的代码行连接到数据库,而不是运行一些查询.

I am working on one .vbs file in which I am connecting to DB using below lines of code and than running some queries.

Set cm = CreateObject("ADODB.Command")
cm.ActiveConnection = "Driver={Microsoft ODBC for Oracle};Server ="+sInst+"; UID="+sUID+";PWD="+sPWD
cm.CommandType = 1 
cm.CommandText = sSQL 
cm.Execute()
Set cm = Nothing

对我来说奇怪的是,当我将这些行复制到QTP并从QTP运行它时,它工作正常. 但是,当运行.vbs文件(通过双击和从cmd运行)时,它给了我以下错误:

Strange thing for me is when I am copying these lines to QTP and run it from QTP, it's working fine. But when running .vbs file (by double clicking and from cmd), it is giving me below error:

[Microsoft] [ODBC驱动程序管理器]找不到数据源名称,并且未指定默认驱动程序

我在另一台机器上都正常工作.我尽力验证两台机器上的所有东西,但我没有得到.

I've other machine on which it's working fine both the way. I tried my best to verify all the things in both the machine, but I am not getting it.

我很感谢您的任何想法/帮助/建议.

I appreciate any thought / help / suggestion.

谢谢.

快速更新:
由于vbs无法正常工作,因此我尝试了googled并使用以下代码行创建了批处理文件:

Quick update:
As vbs is not working I tried googled and create batch file with below line:

C:\Windows\SysWoW64\cscript.exe //NoLogo filepath\xyz.vbs

现在可以正常工作了.
那么问题是如何从 SysWoW64 使用ODBC而不是从 system32 ...使用ODBC运行vb ??

And its working now.
So question is how run vbs using ODBC from SysWoW64 and not from system32...?

推荐答案

64位Windows上的进程是纯32位或纯64位.
默认情况下,64位Windows在无法调用任何32位DLL的64位引擎中执行vbscript.

Processes on 64-bit Windows are either pure 32-bit or pure 64-bit.
By default 64-bit Windows is executing your vbscript in a 64-bit engine which cannot call any 32-bit DLLs.

64位VBScript将使用64位ODBC,它将只能调用64位Oracle软件(如果已安装).
32位VBScript将使用32位ODBC,它将只能调用32位Oracle软件(如果已安装).

64-bit VBScript will use 64-bit ODBC which will only be able to call 64-bit Oracle software (if installed).
32-bit VBScript will use 32-bit ODBC which will only be able to call 32-bit Oracle software (if installed).

正如您所发现的那样,大多数内置Windows程序的32位版本在64位Windows上是看不见的.您必须自己明确运行32位版本的ODBC管理员或CSCRIPT.
根据您的描述,您似乎已经在计算机上安装并配置了32位Oracle软件.通常需要单独安装和配置64位Oracle软件.

As you have discovered the 32-bit versions of most built-in Windows programs are hidden away from view on 64-bit Windows. You have to explicitly run the 32-bit version of ODBC administrator or CSCRIPT yourself.
From what you describe, you seem to have 32-bit Oracle software installed and configured on your machine. 64-bit Oracle software usually needs to be installed and configured separately.

这篇关于[Microsoft] [ODBC驱动程序管理器]找不到数据源名称且未指定默认驱动程序:奇怪的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆