电脑连接oracle,python windows电脑连接oracle

假如需要在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.解压,添加环境变量:

e18022a570aa

image.png

3.添加另一个步骤:

新建一个文件:tnsnames.ora ,记住它的目录我的是这个:

e18022a570aa

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)

)

)

把这个文件路径添加到环境变量:

e18022a570aa

image.png

然后重启你的IDE,

差不多就OK啦

参考教程:

https://blog.csdn.net/white_xuqin/article/details/82878860

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值