[英]Connect to Oracle DB from JavaScript
I am using a proprietary automated testing product that uses a javascript engine to run test scripts. 我正在使用专有的自动测试产品,该产品使用javascript引擎来运行测试脚本。
I am trying to connect to Oracle DB on a server to setup test data/environment. 我试图连接到服务器上的Oracle DB来设置测试数据/环境。 My code uses the following connection string:
我的代码使用以下连接字符串:
var dbDriverString = 'Driver={Microsoft ODBC for Oracle};Server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=1.1.1.1)(PORT=1521))(CONNECT_DATA=(SID=dbname)));Uid=abc;Pwd=abc;';
var connectionString = dbDriverString;
if (Database.DoAttach(connectionString, '') == true)
Tester.Assert('Connected to database.', true);
I installed Oracle Database 11g Release 2 Client (11.2.0.1.0) for Microsoft Windows (x64) client on my Windows VM. 我在Windows VM上为Microsoft Windows(x64)客户端安装了Oracle Database 11g第2版客户端(11.2.0.1.0)。 I am unable to connect to the database.
我无法连接到数据库。 I keep getting the following error:
我不断收到以下错误:
[Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle failed on SQL_HANDLE_ENV failed.
[Microsoft] [ODBC驱动程序管理器] SQL_HANDLE_ENV上驱动程序的SQLAllocHandle失败。
I have setup all paths correctly. 我已经正确设置了所有路径。 ORACLE_HOME is set, ORACLE_HOME/bin is also set as environment variable.
设置了ORACLE_HOME,还将ORACLE_HOME / bin设置为环境变量。 I have also tried to use other drivers/connection strings.
我也尝试过使用其他驱动程序/连接字符串。
Any suggestions will be helpful. 任何建议都会有所帮助。
Major issue was a mismatch between Application arch and Drivers arch. 主要问题是应用程序架构和驱动程序架构之间的不匹配。 Following was done on a fresh vm from scratch:
从头开始在新的虚拟机上执行以下操作:
If you end up defining a User/System DSN for Oracle_Ora11gHome1 driver (wtf Oracle), TNS Service Name is yourip:port/sid 如果最终为Oracle_Ora11gHome1驱动程序(wtf Oracle)定义了用户/系统DSN,则TNS服务名称为yourip:port / sid。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.