Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

weblogic6.1 - AS 400 using JTOpen

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using weblogic6.1 with
IBM Toolbox JTOpen ( jt400.jar ) to connect to AS400
My weblogic configuration is as follows
JDBC Connection
Name <POOL_NAME>
URL: jdbc:as400://<IPADDRESS>/<LIBRARYNAME>
Driver Classname com.ibm.as400.access.AS400JDBCDriver
Properties
user=<USERNAME>
server=<IPADDRESS>

password <PASSWORD>

Connections tab

Initial Capacity: 1
Maximum Capacity: 10
Capacity Increment: 2
Login Delay Seconds: 1 seconds
Refresh Period: 10 minutes
Supports Local Transaction

Allow Shrinking - checked

Shrink Period: 15 minutes
Prepared Statement Cache Size: 25


Testing tab
Test Table Name <TABLENAME>
Data source configuration
Name: <DATA_SOURCE_NAME>
JNDI Name: jdbc/<DATA_SOURCE_NAME>
Pool Name: <POOL_NAME>
Row Prefetch Enabled - unchecked
Row Prefetch Size: 48
Stream Chunk Size: 256 bytes
My code is as follows
try
{
//for weblogic
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, "t3://localhost:80";);
log("Getting initial context");
InitialContext ctx = new InitialContext( env );
log("Getting datasource for context jdbc/" + poolName );
ds = (DataSource) ctx.lookup ("jdbc/" + poolName);
log("Getting connection for context jdbc/" + poolName );
}
catch (NamingException ne)
{
ne.printStackTrace();
throw new OasisException (OASIS_SEVERITY_LEVEL_FOR_FATAL_EXCEPTIONS, "Error looking up the datasource for pool " + poolName, ne);
}
catch (Exception e)
{
e.printStackTrace();
throw new OasisException (OASIS_SEVERITY_LEVEL_FOR_FATAL_EXCEPTIONS, "Error looking up the datasource for pool " + poolName, e);
}

try
{
this.conn = ds.getConnection ();
log("Got connection for context jdbc/" + poolName );

try
{
Statement st = this.conn.createStatement();
st.execute( "select count(*) from sysprocs" );
st.close();
}
catch (SQLException e)
{ //WLtoWS: should be StaleConnection, but Studio can't find it
if (e.toString().indexOf( "StaleConnectionException" ) != -1) {
this.conn = ds.getConnection();
Statement st = this.conn.createStatement();
st.execute( "select count(*) from sysprocs" );
st.close();
}
else
{
throw e;
}
}

}
catch (SQLException sq)
{
sq.printStackTrace();
throw new OasisException (OASIS_SEVERITY_LEVEL_FOR_FATAL_EXCEPTIONS, "SQL Error during get connection for pool " + poolName, sq);
}
catch (Exception e) {
throw new OasisException (OASIS_SEVERITY_LEVEL_FOR_FATAL_EXCEPTIONS, "Error during get connection for pool " + poolName, e);
}

In my code I am able to get connection but when I try to execute query, I try to execute query I get following exception

java.sql.SQLException: [SQL0204] SYSPROCS in <LIBRARYNAME> type *FILE not found.
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:485)
at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1216)
at com.ibm.as400.access.AS400JDBCStatement.execute(AS400JDBCStatement.java:1383)
at weblogic.jdbc.pool.Statement.execute(Statement.java:207)
at weblogic.jdbc.rmi.internal.StatementImpl.execute(StatementImpl.java:206)
at weblogic.jdbc.rmi.internal.StatementImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:305)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:274)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
End server side stack trace
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:85)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:136)
at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
at $Proxy3.execute(Unknown Source)
at weblogic.jdbc.rmi.internal.StatementStub.execute(StatementStub.java:178)
at weblogic.jdbc.rmi.SerialStatement.execute(SerialStatement.java:305)
at com.mccrackenfs.oasis.fw.db.OasisDatabase.getConnection(OasisDatabase.java:116)
at com.asur_easi.test.ConnectionPoolTest.testServerPool(ConnectionPoolTest.java:29)
at com.asur_easi.test.ConnectionPoolTest.main(ConnectionPoolTest.java:122)
com.mccrackenfs.oasis.fw.utils.OasisException
at com.mccrackenfs.oasis.fw.db.OasisDatabase.getConnection(OasisDatabase.java:143)
at com.asur_easi.test.ConnectionPoolTest.testServerPool(ConnectionPoolTest.java:29)
at com.asur_easi.test.ConnectionPoolTest.main(ConnectionPoolTest.java:122)
 
Space seems cool in the movies, but once you get out there, it is super boring. Now for a fascinating tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic