You have not included stacktrace so it is hard to say what happened.
From your comment it seems that you suspect Informix JDBC driver. I have tried similar code with JDBC 4.10.JC2DE and it seems to work. There is Jython code:
"""
create procedure tryBaru_Procedure(v_name varchar(50),v_city varchar(20),out v_id int)
let v_id = 10;
end procedure;
"""
def test_call(db_url, usr, passwd):
try:
print("\n\n%s\n--------------\ncall..." % (db_url))
db = DriverManager.getConnection(db_url, usr, passwd)
proc = db.prepareCall("{ call tryBaru_Procedure(?, ?, ?) }");
proc.setString(1, 'v_name')
proc.setString(2, 'v_city')
proc.registerOutParameter(3, Types.VARCHAR)
proc.executeUpdate();
v_id = proc.getInt(3)
print('v_id: %s' % (v_id))
db.close()
except:
print("there were errors!")
s = traceback.format_exc()
sys.stderr.write("%s\n" % (s))
It prints 10
as expected.
So maybe you use older version of Informix JDBC driver with some bugs, but I think there may be problem with dbConn
or conn
variable. Are you sure you have connection to database?
Edited:
If you want to have only one connection (Singleton) then try something like:
public Connection getConnection() throws Exception {
/* Define the database to be used, the driver,
* the connection url, and the username and
* password to connect the database
*/
if (connection == null) {
driver = "com.informix.jdbc.IfxDriver";
Class.forName(driver);
connectionURL = "jdbc:informix-sqli://127.0.0.1:9090/barubuat:informixserver=lo_informix1210;user=informix;password=abc123";
connection = DriverManager.getConnection(connectionURL);
}
return connection;
}