python - Deploying cx_Oracle onto various versions of Oracle Client -


I have some small python applications that use cx_Oracle to connect to an Oracle database. I deploy these apps with py2exe, which works fine in many cases.

The problem is that many standard Oracle client versions (for example, 9i and 10 grams) do not need to install a lot of people, and this is standardized on the same Oracle client version It would be very disappointing to try. I am currently using 9.2 client for 9i customer, and when I include the Cx_Oracle 4.4.1 library in the exe as a result of PE2XX and will not work with 10g customers.

I do not use any specific features of any Oracle versions, so there really is not a specific reason for me that the client version is being used except for CX_ORRALIC compatibility issues.

The ideal solution will be compiled in any way, a version which is completely independent of the Oracle client installed on the machine.

If this is not possible, then I would be willing to compile the different exes for each major Oracle version (my_app_9i.exe, my_app_10g.exe, etc.) but I also set up a new method Even after I can not do that my old version can be notified, I have to change the library further and backward to compile other versions.

Any advice or other options are welcome. If you want to create multiple cx_orracle versions (like: cx_Oracle10g, cx_Oracle11g, etc.), then you have to cx_Oracle

setup () ; The first parameter is to name the module. You only need to change "cx_ oracle" "cx_ oracle" + ver , where ver is 10g , 11g < / Code>, etc. Either make multiple scripts and hard-codes, or add another parameter to dynamically select setup.py .

Of course, once you've found that, you need a mechanism to load the right module on the runtime. To do this, you want to create your own cx_ oracle module that has a __init __.py file that looks like this:

 Try: Try: Importing from CX_Oracle 9G import * Excluding IRR: Try: CX_Oracle 10G import * Excluding import error: Try: CX_Orcl 11G import * to  

You just have your custom cx_Oracle module plus right cx_OracleXg module with your application.

Alternatively, you can dynamically check your custom cx_Oracle module for each available Oracle client library (9G, 10G, 11G, etc.) and its After importing only the correct match cx_OracleXg module In this case, you only need to make a binary shipment, in which your custom cx_ oracle module plus all cx_OracleXg Modules are included.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -