用c++开发连接数据库的应用程序进需要了解应用程序是如何连接数据库的
1,要安装oracle客户端。其实不用将整个客户端要安装上。它主要是要用到几个库函数。如果你对这些库不熟悉的话就直接安装上好了
2,设置必要的环境变量
PATH上指明oracle客户端的bin目录
LD_LIBRARY_PATH上指明oracle客户端用到的库
3,设置tnsname其格式如下
# tnsnames.ora Network Configuration File: /oracle/product/10.2.0.1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
WINKSDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.169)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = winksdb)
)
)
WINKSDB_169 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.169)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = winksdb)
)
)
4. 测试该客户端是否可以连接上数据库
>sqlplus /nolog
>conn 用户名/密码@数据库服务名
如果能连接上证明一切正常。
阅读(684) | 评论(0) | 转发(0) |