Recently done a project, through the VC ODBC access to the Oracle database, on my computer can run normally, not on other computers, because there is no Oracle ODBC driver, unable to configure the Oracle data source. Most of the blog posts on the Web are installed by the Oracle client to resolve. I think it is a small program, there is no need to install the client, 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
Website: http://www.oracle.com/technetwork/cn/topics/winsoft-095945-zhs.html
As time passes, the version number is updated and the URL changes. So we can Baidu Oracle instantclient basiclite keyword, and then search results found in the Oracle official website, to download. The consent agreement is required for download and is an Oracle registered user, and user registration is free of charge.
2. Unzip the two files to the same folder
A, unzip each of the two files
B, decompression after the two folders have instantclient_12_1 directory, the contents of the ODBC Instantclient_12_1 directory copy to basicclient under the instantclient_12_1 inside
C, in order to make the directory neat introduction, the Basicclient under the Instantclient_12_1 directory copy to D:\Program Files\instantclient_12_1
3. Copy the network directory on the computer where the Oracle database is located to the Instantclient_12_1 directory, and the network of my Oracle server's computer is located in D:\oraclexe\app\oracle\product\ 11.2.0\server this position.
4. Modify the Network\admin\tnsnames.ora file to replace the hostname with an IP address. In the following example, 10.17.176.138 was previously the hostname on the computer where 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 the ADMIN directory, my configuration is D:\Program files\instantclient_12_1\network\admin
6. Double-click the Odbc_install.exe in the Instantclient_12_1 directory to complete the installation. Note: The Doc box appears during installation and flashes over, and you may not be able to determine if the installation is correct. You can actually 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 turn off the firewall on the computer where the Oracle database is located, or allow exceptions to TCP 1521 ports. Configure client computers, control Panel, data source, user dsn-> Add, select Oracle in Instantclient_12_1,tns Service name, select the database name, my name is XE, click Test Connection, if the prompt success is OK.
9. Prevent garbled characters
On the computer where the database is installed (my ORACLE is installed on the window), 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, whose value is the Nls_lang value obtained above. The Nls_lang of my server is simplified Chinese_china. Zhs16gbk