如何使用system.data.oracleclient为oracle建立连接字符串,包括主机名,实例名称,用户ID,密码? [英] how to make a connection string for oracle that includes hostname, instance name, user id, password using system.data.oracleclient?

查看:105
本文介绍了如何使用system.data.oracleclient为oracle建立连接字符串,包括主机名,实例名称,用户ID,密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在oracle中建立了一个连接字符串,例如:

I have made a connection string in oracle like:

Data Source=hostname;Initial Catalog=IMPORT_UTILITY;User ID=abc;password=123

我想对oracle做同样的事情.我正在使用 ODBC .

I want to make the same for oracle. I am using ODBC.

谁能告诉我,oracle的连接字符串将与使用odbc的上述sql连接字符串等效吗?

can anyone tell me what will be the connection string for oracle that will be equivalent to above sql connection string using odbc?

推荐答案

对于Oracle 12c R2和Instant Client ODBC驱动程序(版本12.2.0.1.0),以下连接字符串应起作用,而无需创建DSN和/或tnsnames.ora文件:

For Oracle 12c R2 and the Instant Client ODBC Driver (version 12.2.0.1.0) the following connection string should work without having to create a DSN and/or a tnsnames.ora file:

DRIVER={Oracle in instantclient_12_2};DBQ=HOST:PORT/SERVICE_NAME;UID=USERNAME;PWD=PASSWORD

Oracle 12c R2泊坞映像的ODBC连接字符串示例:

Example ODBC connection string for the Oracle 12c R2 docker image:

DRIVER={Oracle in instantclient_12_2};DBQ=127.0.0.1:1521/ORCLPDB1.localdomain;UID=sys;PWD=Oradoc_db1 as sysdba

这篇关于如何使用system.data.oracleclient为oracle建立连接字符串,包括主机名,实例名称,用户ID,密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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