假如需要在windows上连接Oracle,那么则需要:instantclient-basic-windows.x64-18.5.0.0.0dbru.zip
这个好像是oracle客户端:
按照它给到的步骤来:
https://oracle.github.io/odpi/doc/installation.html#id1
防止网址不能访问 ,我把内容复制下来:
1. Download an Oracle 18, 12, or 11.2 “Basic” or “Basic Light” zip file: [64-bit](http://www.oracle.com/technetwork/topics/winx64soft-089540.html) or [32-bit](http://www.oracle.com/technetwork/topics/winsoft-085727.html), matching your application architecture.
2. Unzip the package into a directory that is accessible to your application. For example unzip `instantclient-basic-windows.x64-18.3.0.0.0dbru.zip` to `C:\oracle\instantclient_18_3`.
3. Add this directory to the `PATH` environment variable. For example, on Windows 7, update `PATH` in Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables -> System Variables -> PATH. The Instant Client directory must occur in `PATH` before any other Oracle directories.
Restart any open command prompt windows.
To avoid interfering with existing tools that require other Oracle Client versions, instead of updating the system-wide `PATH` variable, you may prefer to write a batch file that sets `PATH`, for example:
REM mywrapper.bat
SET PATH=C:\oracle\instantclient_18_3;%PATH%
myapp %*
Invoke this batch file everytime you want to run your application.
Alternatively use `SET` to change your `PATH` in each command prompt window before you run python.
Another option is to move the unzipped Instant Client files to the same directory as the ODPIC.DLL (or into the directory of the application’s binary, if ODPI-C is compiled into application). If you do this, then `PATH` does not need to be set.
4. If you intend to co-locate optional Oracle configuration files such as `tnsnames.ora`, `sqlnet.ora` or `oraaccess.xml` with Instant Client, then create a `network\admin` subdirectory, if it does not exist, for example `C:\oracle\instantclient_18_3\network\admin`.
This is the default Oracle configuration directory for applications linked with this Instant Client.
Alternatively, Oracle configuration files can be put in another, accessible directory. Then set the environment variable `TNS_ADMIN` to that directory name.
1.下载,按照它的步骤来。
2.解压,添加环境变量:
image.png
3.添加另一个步骤:
新建一个文件:tnsnames.ora ,记住它的目录我的是这个:
image.png
这个文件tnsnames.ora 内容如下:
orcl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.102)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testdb)
)
)
把这个文件路径添加到环境变量:
image.png
然后重启你的IDE,
差不多就OK啦
参考教程:
https://blog.csdn.net/white_xuqin/article/details/82878860