OCCI - 连接到远程数据库

时间:2011-06-15 14:49:41

标签: c++ oracle occi

我对Oracle很新。我正在尝试使用OCCI连接到远程Oracle数据库。我在这一点上找到的所有例子都是用于连接到本地数据库。有人可以指出我正确的方向,让我知道在哪里可以找到一个示例连接让我超越这一点?谢谢,迈克

1 个答案:

答案 0 :(得分:3)

createConnection( "name", "passwrd", "string")

"string" stands either for the connection name that is resolved with the Oracle "tnsnames.ora" file which should be located in your ORACLE_HOME(Oracle install dir)\NETWORK\ADMIN directory or for a connection string like below

Code:
connection_name =
  (DESCRIPTION =
       (ADDRESS=(PROTOCOL = TCP)(HOST = ip_address)(PORT = listener_port))
       (CONNECT_DATA= (SERVICE_NAME = listener_service_name)
       (SERVER = DEDICATED))
 )