RPG calls through Glassfish connection pooling

228 views Asked by At

Normally we do RPG calls using jt400.jar as follows.

AS400 conn = new AS400("XXX.XXX.XXX.XXX", "USERID", "Password");
ProgramCall program = new ProgramCall(conn, "/XXX.LIB/YYYY.LIB/ZZZZZ.PGM",
parameters);
program.run();

I'm working on a project that i need to execute the above RPG program using a connection pool established on a GlassFish server. The connection pool is created using below settings

<jdbc-resource pool-name="arix" jndi-name="jdbc/ArixSystemResource"></jdbc-resource>
<jdbc-connection-pool max-pool-size="8" datasource-classname="com.ibm.as400.access.AS400JDBCDataSource" res-type="javax.sql.DataSource" steady-pool-size="4"  name="ARIXPool" >
  <property name="password" value="XXXX"></property>
  <property name="user" value="XXXXX"></property>
  <property name="servername" value="XXX.XXX.XXX.XXX"></property>
</jdbc-connection-pool>
<jdbc-resource pool-name="arix" jndi-name="jdbc/ArixSystemResource"></jdbc-resource>

I can get a JDBC connection by using the below code

Context context = new InitialContext();
DataSource das = (DataSource) context.lookup("jdbc/ArixSystemResource");
Connection conn = das.getConnection();

But, is there any way to get a AS400 object from the above data source in order to call RPGs. Or can i re-configure the connection pool to retrieve AS400 objects. Thanks in advance

0

There are 0 answers