在本文中,您将会了解到关于InterfaceError:无法获取Oracle环境句柄;ORACLE_HOME是正确的,SQL*Plus将连接的新资讯,同时我们还将为您解释oracle无法获得一组稳定的
在本文中,您将会了解到关于InterfaceError:无法获取Oracle环境句柄;ORACLE_HOME是正确的,SQL * Plus将连接的新资讯,同时我们还将为您解释oracle无法获得一组稳定的源的相关在本文中,我们将带你探索InterfaceError:无法获取Oracle环境句柄;ORACLE_HOME是正确的,SQL * Plus将连接的奥秘,分析oracle无法获得一组稳定的源的特点,并给出一些关于64位Oracle客户端上PLSQL无法识别ORACLE_HOME解决方案、cx_Oracle - Python Interface for Oracle Database、DECLARE_META_INTERFACE(INTERFACE)和IMPLEMENT_META_INTERFACE(INTERFACE, NAME)宏定义分析、InterfaceError:(sqlte3.InterfaceError)Error binding parameter 0的实用技巧。
本文目录一览:- InterfaceError:无法获取Oracle环境句柄;ORACLE_HOME是正确的,SQL * Plus将连接(oracle无法获得一组稳定的源)
- 64位Oracle客户端上PLSQL无法识别ORACLE_HOME解决方案
- cx_Oracle - Python Interface for Oracle Database
- DECLARE_META_INTERFACE(INTERFACE)和IMPLEMENT_META_INTERFACE(INTERFACE, NAME)宏定义分析
- InterfaceError:(sqlte3.InterfaceError)Error binding parameter 0
InterfaceError:无法获取Oracle环境句柄;ORACLE_HOME是正确的,SQL * Plus将连接(oracle无法获得一组稳定的源)
尝试导入cx_Oracle时,出现标准的“ DLL加载失败;找不到模块”错误。我已经安装了正确的即时客户端,路径都正确…运行Dependency
Walker告诉我我缺少以下.dll的MSVCR90,GPSVC,IESHIMS。
我正在运行Oracle 11g和Python
2.7的即时客户端。谁有想法?我发现的大多数答案都包含不正确的路径,但事实并非如此……此外,我在系统上其他任何地方都找不到这些.dll。
编辑:我最终安装了Oracle XE 11g(32位);Python
2.7和cx_Oracle均为32位(我还要补充一点,我在Windows上)。cx_Oracle现在可以干净安装;但是在连接时我收到一个错误:
InterfaceError: Unable to acquire Oracle environment handle
ORACLE_HOME路径正确,PATH文件夹中的bin也是正确的…
答案1
小编典典我遇到了同样的问题:您必须将变量设置ORACLE_HOME
为与Oracle客户端文件夹相匹配(例如,在Unix上:通过外壳;在Windows上:如果配置面板的环境变量中不存在新变量,则创建一个新变量)因为这是cx_Oracle
模块链接到它的方式。
您的文件夹$ORACLE_HOME/network/admin
(%ORACLE_HOME%\network\admin
在Windows上)是tnsnames.ora
文件应存在的位置。
64位Oracle客户端上PLSQL无法识别ORACLE_HOME解决方案
PLSQL到目前为止只有32位的程序,而大多数的桌面系统基本都是使用64位的Windows操作系统,在64位的Windows上,大多数情况下也是安
1、问题
PLSQL到目前为止只有32位的程序,而大多数的桌面系统基本都是使用64位的Windows操作系统,在64位的Windows上,大多数情况下也是安装64位的Oracle client程序,这种组合,导致plsql无法识别到ORACLE_HOME目录,读取不到tnsnames.ora文件中的连接串
2、解决方案
2.1 在Windows上配置ORACLE_HOME环境变量
右击“我的电脑”点击”属性“菜单,进入”系统属性“对话框,选择”高级“标签,点击“环境变量”,在用户变量框区域,新建一个名为‘ORACLE_HOME的变量名,根据自己的ORACLE实际安装目录填写其值,例如,笔者的环境的ORACLE_HOME的值为” C:\oracle\product\12.1.0\dbhome_1”
2.2 引用instantclient-basic-win32-10.2.0.5
将instantclient-basic-win32-10.2.0.5.zip文件解压,压缩后的文件,复制到PLSQL Developer安装目录的product目下,如C:\oracle\product\,最终instantclient的目录为C:\oracle\product\C:\oracle\product\instantclient-basic-win32-10.2.0.5\instantclient_10_2
instantclient-basic-win32-10.2.0.5.zip文件,笔者已上传到“系统性能优化专业群”群共享中供各位下载。
2.3 在PLSQL中配置ORACLE_HOME与OCI库
2.3.1 配置ORACLE_HOME
在PLSQL主菜单上点击Tools,选择Preferences子菜单,进入“首选页”对话框,在“连接”选项卡的右侧,找到“Oracle主目录名(自动检测为空)”,在该框中填写ORACLE的HOME目录名,如:“C:\oracle\product\12.1.0\dbhome_1”
2.3.2 配置OCI库
在PLSQL主菜单上点击Tools,,选择Preferences子菜单,进入“首选页”对话框,在“连接”选项卡的右侧,找到“OCI库(自动检测为空)”,在该框中填写oci.dll文件的绝对路径,如:“C:\oracle\product\instantclient-basic-win32-10.2.0.5\instantclient_10_2\oci.dll”
3、结果
上述四步配置完成后,重启PLSQL,就可以识别ORACLE_HOME,并能找到ORACLE客户端tnsnames.ora文件中的数据库连接串了。
Oracle 10g 安装后重启系统,用PLSQL连接报没有监听
ORA-03114 PLSQL过程编译断开连接错误
PLSQL 连接 Oracle简单配置
PLSQL批量Forall操作性能提升详解
使用Oracle SQLDeveloper连接数据库并创建用户
Oracle自带的PL/SQL Developer导入导出数据
在64位Win7系统下安装Oracle 11g和Oracle SQL Developer客户端
本文永久更新链接地址:
cx_Oracle - Python Interface for Oracle Database
cx_Oracle - Python Interface for Oracle Database
Documentation·Installation.Release Notes.Source code·Mailing list
About cx_Oracle
cx_Oracleis a Python extension module that enables access to Oracle Database. It conforms to the Python database API 2.0specificationwith a considerable number of additions and a couple of exclusions.
cx_Oracle is licensed under a BSD license which you can findhere.
cx_Oracle 6 has been tested with Python version 2.7,and with versions 3.4 and higher. You can use cx_Oracle with Oracle 11.2,12.1 and 12.2 client libraries. Oracle's standard client-server version interoperability allows connection to both older and newer databases. For example Oracle 12.2 client libraries can connect to Oracle Database 11.2 or later.
Features
-
Easily installed from PyPI.
-
Support for Python 2 and 3.
-
Support for Oracle Client 11.2,12.1 and 12.2. Oracle's standard cross-version interoperability,allows easy upgrades and connectivity to different Oracle Database versions.
-
Connect to Oracle Database 9.2,10,11 or 12 (depending on the Oracle Client version used).
-
sql and PL/sql Execution. The underlying Oracle Client libraries have significant optimizations including compressed fetch,pre-fetching,client and server result set caching,and statement caching with auto-tuning.
-
Full use of Oracle Network Service infrastructure,including encrypted network traffic and security features.
-
Extensive Oracle data type support,including large object support (CLOB and BLOB).
-
Direct binding to sql objects. One great use case is binding Python objects to Oracle Spatial SDO objects.
-
Array operations for efficient INSERT and UPDATEs.
-
Array row counts and batch error handling for array operations.
-
Fetching of large result sets.
-
REF CURSOR support.
-
Support for scrollable cursors. Go back and forth through your query results.
-
Fetch PL/sql Implicit Results. Easily return query results from PL/sql.
-
Row Prefetching. Efficient use of the network.
-
Client Result Caching. Improve performance of frequently executed look-up statements.
-
Support for Advanced Queuing. Use database notifications to build micro-service applications.
-
Continuous Query Notification. Get notified when data changes.
-
Support for Edition Based RedeFinition. Easily switch applications to use updated PL/sql logic.
-
Support for setting application context during the creation of a connection,making application Metadata more accessible to the database,including in logoN triggers.
-
End-to-end monitoring and tracing.
-
Transaction Management.
-
Session Pooling.
-
Database Resident Connection Pooling (DRCP).
-
Privileged Connections.
-
External Authentication.
-
Database startup and shutdown.
-
Oracle Database High Availability Features,such as FAN notifications and Transaction Guard support.
DB API specification exclusions: The time data type is not supported by Oracle and is therefore not implemented. The methodcursor.nextset()
is not implemented either as the DB API specification assumes an implementation of cursors that does not fit well with Oracle's implementation of cursors and implicit results. See the methodcursor.getimplicitresults()for more information.
Installation
Seecx_Oracle Installationfor detailed instructions.
-
The simplest way to install cx_Oracle is with pip:
python -m pip install cx_Oracle --upgrade
If a binary wheel package is not available onPyPIfor your platform,the source package will be used.
Note that if you download a source zip file directly from GitHub then you will also need to download anODPI-Csource zip file and extract it inside the directory called "odpi".
-
After cx_Oracle is installed,Oracle client libraries must also be installed and configured. These can be from Oracle Instant Client,from a local Oracle Database,or from a full Oracle Client installation.
If you need the libraries,download and unzip theOracle Instant Client'Basic' package for your platform and set PATH,LD_LIBRARY_PATH,or similar platform-specific library path loading environment. See theinstallation notes for ODPI-Cfor help.
Versions 11.2,12.1 and 12.2 of the Oracle Client libraries on Linux,Windows and macOS are supported. Users have also reported success with other platforms.
If you require cx_Oracle 5.3,download a Windows installer fromPyPIor usepython -m pip install cx-oracle==5.3
to install from source.
Very old versions of cx_Oracle can be found in the files section atSourceforge.
Example
from __future__ import print_function import cx_Oracle connection = cx_Oracle.connect("hr","welcome","localhost/orclpdb") cursor = connection.cursor() cursor.execute(""" SELECT first_name,last_name FROM employees WHERE department_id = :did AND employee_id > :eid""",did = 50,eid = 190) for fname,lname in cursor: print("Values:",fname,lname)
For more examples,please see thesamplesand thetest suite. You can also look at the scripts incx_OracleToolsand the modules incx_PyOracleLib.
Documentation
See thecx_Oracle DocumentationandRelease Notes.
Help
Issues and questions can be raised with the cx_Oracle community onGitHubor on themailing list.
DECLARE_META_INTERFACE(INTERFACE)和IMPLEMENT_META_INTERFACE(INTERFACE, NAME)宏定义分析
定义
frameworks\base\include\utils\IInterface.h
|
说明:其中的I##INTERFACE,##表示连接两个宏定义,在这里INTERFACE是模板名,被当作是宏定义。如果INTERFACE是ServiceManager那么I##INTERFACE就是IServiceManager。
使用:例子ICameraService
定义声明的宏定义:DECLARE_META_INTERFACE(INTERFACE)
ICameraService.h [frameworks\base\include\ui]
|
把这句展开就是:
|
就是说在ICameraService接口类中定义了一个String16的变量和两个函数。
然后在ICameraService.cpp [frameworks\base\libs\ui]中定义另外一个实现的宏定义。
就这么一句:
|
展开为:
|
展开就是说初始化了一个变量descriptor,实现了BpCameraService类的2个函数:getInterfaceDescriptor (), asInterface()。而且这个宏定义不属于在这个cpp文件中定义的BpCameraService类和在.h文件中定义的BnCameraService类。
在Camera.cpp [frameworks\base\libs\ui]中
const sp& Camera::getCameraService()函数调用
mCameraService = interface_cast(binder);
著名的interface_cast函数
|
interface_cast调用的是宏定义中的asInterface函数,然后返回的是new BpCameraService (obj)对象。
InterfaceError:(sqlte3.InterfaceError)Error binding parameter 0
最近在学习 scrapy 爬虫,爬取别人博客上的文章标题。如果不加数据库,能够很好的输出结果,虽然排版不好看,但是使用 sqlalchemy 存储数据,一直出错,错误提示所图片所示:
我的 item [''title''] 是通过以下的解析式来的:
item[''title''] = sel.xpath(''//*[@]/a/text()'').extract()
from sqlalchemy import create_engine, Column, Integer, String from sqlalchemy.ext.declarative import declarative_base DeclarativeBase = declarative_base() def db_connect(): return create_engine(''sqlite:///./sqlalchemy.db'',echo = True) def create_myblog_table(engine): DeclarativeBase.metadata.create_all(engine) class MyBlog(DeclarativeBase): __tablename__ = ''myblog'' id = Column(Integer, primary_key = True) title = Column(''title'', String(200))
from sqlalchemy.orm import sessionmaker from model import MyBlog, db_connect, create_myblog_table class MyblogPipeline(object): def __init__(self): engine = db_connect() create_myblog_table(engine) self.Session = sessionmaker(bind = engine) def process_item(self, item, spider): session = self.Session() myblog=MyBlog(**item) session.add(myblog) session.commit() return item
我们今天的关于InterfaceError:无法获取Oracle环境句柄;ORACLE_HOME是正确的,SQL * Plus将连接和oracle无法获得一组稳定的源的分享就到这里,谢谢您的阅读,如果想了解更多关于64位Oracle客户端上PLSQL无法识别ORACLE_HOME解决方案、cx_Oracle - Python Interface for Oracle Database、DECLARE_META_INTERFACE(INTERFACE)和IMPLEMENT_META_INTERFACE(INTERFACE, NAME)宏定义分析、InterfaceError:(sqlte3.InterfaceError)Error binding parameter 0的相关信息,可以在本站进行搜索。
本文标签: