Recently done a project, through VC ODBC access to Oracle database, on my computer can run normally, not running on other computers, because there is no Oracle ODBC driver, unable to configure Oracle data source. Most of the blog posts on the Web are installed with Oracle clients to solve. I think it is a small program, there is no need to install the client bar, referring to the online blog and visited the Oracle Web site, so this article.
1. Download ODBC driver
Need to download two things
Instantclient-basiclite-nt-12.1.0.1.0.zip
Instantclient-odbc-nt-12.1.0.1.0.zip
URL: http://www.oracle.com/technetwork/cn/topics/winsoft-095945-zhs.html
Due to time lapse, the version number will be updated and the URL will change. So we can Baidu Oracle instantclient basiclite keywords, and then search results to see the official Oracle website, download. You need to agree to the agreement and is an Oracle registered user, user registration is free.
2, unzip the two files to the same folder
A, extract the two files separately
B, uncompressed after the two folders have instantclient_12_1 directory, the ODBC Instantclient_12_1 directory content copied to the basicclient under the instantclient_12_1 inside
C, in order to make the catalog neat introduction, will basicclient under the Instantclient_12_1 directory copy to D:\Program Files\instantclient_12_1
3, the Oracle database on the computer network directory copy to the Instantclient_12_1 directory, my Oracle server computer network in D:\oraclexe\app\oracle\product\ 11.2.0\server this position.
This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/
4, modify the Network\admin\tnsnames.ora file, replace the host name with an IP address. In the following example, 10.17.176.138 was previously the hostname of the computer on which the Oracle database resides. The host name may not be connected properly, so replace it with an IP address.
XE =
(DESCRIPTION =
(address = (PROTOCOL = TCP) (HOST = 10.17.176.138) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = XE)
)
)
5, add environment variable tns_admin, variable value point to ADMIN directory, my configuration is D:\Program files\instantclient_12_1\network\admin
6, double-click the Instantclient_12_1 directory to complete the installation of Odbc_install.exe. Note: The Doc box appears when you install it, and you may not be able to determine if it is properly installed. In fact you can cmd into the Instantclient_12_1 directory, and. \odbc_install.exe manual Installation.
8. Configure the data source and test
To not affect the test, first shut down the firewall on the computer where the Oracle database resides, or allow the exception TCP 1521 port. Configure client computers, Control Panel-> data source-> user dsn-> Add select Oracle in INSTANTCLIENT_12_1,TNS Service name Select database name, my name is XE, point test Connection, if the prompt is successful, OK.
9, prevent garbled
On the computer where the database is installed (my ORACLE is installed on Windows), look at the Nls_lang value under Hkey_local_machine/software/oracle/key_xxx, where xxx is ... , I also cannot say clearly, should be the database name.
Add the environment variable Nls_lang on the client computer, and the value is the Nls_lang value obtained on the above. The Nls_lang of my server is simplified Chinese_china. Zhs16gbk