OpenNTF.org - XPages Extension Library
XPages Extension LibraryOpenDocument&Start=1&Count=300&Collapse=1[/projects/pmt.nsf/ProjectView?ReadForm&Query=]

My Links (Not logged in)
User Name Password
Hosted by Prominic.NET

   Project: XPages Extension Library (Managed by Philippe Riand, Niklas Heidloff, Dave Delay, Akihiro Kosugi, Maire Kehoe, Tony McGuckin, John Piermarini, Martin Donnelly, James Quill, Darin Egan, Padraic Edwards, Andrejus Chaliapinas, Lorcan McDonald, Simon McLoughlin, Paul Hannan)
Actions:

Hide details for The bugThe bug
Bug ID: NOSS-97Y2YU
Description
Submitted by:Alex L Rasmussen
Project Master Chef:Philippe Riand
Niklas Heidloff
Dave Delay
Akihiro Kosugi
Maire Kehoe
Tony McGuckin
John Piermarini
Martin Donnelly
James Quill
Darin Egan
Padraic Edwards
Andrejus Chaliapinas
Lorcan McDonald
Simon McLoughlin
Bug type:
Brief Description:Cannot use java.sql.Connection.createArrayOf in a managed bean
Severity:
Version853.20120126-0415
Status:Submitted

Details

I am trying to use a DB2 stored procedure in a managed bean.

The following code works in a Java agent:

1.     Class.forName("com.ibm.db2.jcc.DB2Driver");
2.     Connection con = DriverManager.getConnection("jdbc:db2://10.10.10.10:50001/MYDB", "userid", "password");
3.     CallableStatement cs1 = con.prepareCall("CALL V1.MYPROC(?)");
4.     Integer[] myArr = new Integer[2];
5.     myArr[0] = 1;
6.     myArr[1] = 2;
7.     cs1.setArray(1, con.createArrayOf("INTEGER", myArr));
8.     cs1.execute();

If I create similar code in a managed bean and utilize the ExtLib connection pool, the code looks like this:

1.     InitialContext ctx = new InitialContext();
2.     DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/db2");
3.     Connection con = ds.getConnection();
4.     CallableStatement cs1 = con.prepareCall("CALL V1.MYPROC(?)");
5.     Integer[] myArr = new Integer[2];
6.     myArr[0] = 1;
7.     myArr[1] = 2;
8.     cs1.setArray(1, con.createArrayOf("INTEGER", myArr));   <-- FAILS
9.     cs1.execute();

In the managed bean, line 8 fails with java.lang.AbstractMethodError: java/sql/Connection.createArrayOf(Ljava/lang/String;[Ljava/lang/Object;) appearing in error-log-0.xml

Generally, this error occurs if the JDBC driver is not a Type 4 driver running Java version 5 or 6. Both the agent and the managed bean reports Java version 1.6.0 and JDBC version 4.13 (IBM Data Server Driver for JDBC and SQLJ).

The connection pool works fine for other purposes such as con.PrepareStatement etc.



Action taken
Status:Submitted
Implemented in Release:
Fix Details:
Modification history
Entered 19-Mar-2012 17:32 by Alex L Rasmussen. Last Modified <none> by <none>.

Feedback

Show details for  (Alex L Rasmusse... on 03/19/2012 05:32:48 PM ) (Alex L Rasmusse... on 03/19/2012 05:32:48 PM )
Check out other projects