16-4. Accessing PL/SQL from Jython
You are working with a Jython program and want to call some PL/SQL stored procedures or functions from it.
zxJDBC API to obtain a connection to the Oracle Database, and then call the PL/SQL stored procedure passing parameters as required. The following code is an example of a Jython script that performs these tasks:
from __future__ import with_statement from com.ziclix.python.sql import zxJDBC # Set up connection variables jdbc_url = "jdbc:oracle:thin:@host:1521:dbname" username = "user" password = "password" driver = "oracle.jdbc.driver.OracleDriver" # obtain a connection using the with-statment with zxJDBC.connect(jdbc_url, username, password, driver) as conn: with ...