wood burning stoves 2.0*
The moose likes BEA/Weblogic and the fly likes weblogic6.1 - AS 400 using JTOpen Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "weblogic6.1 - AS 400 using JTOpen" Watch "weblogic6.1 - AS 400 using JTOpen" New topic
Author

weblogic6.1 - AS 400 using JTOpen

anupv
Greenhorn

Joined: Aug 28, 2002
Posts: 3
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)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: weblogic6.1 - AS 400 using JTOpen
 
Similar Threads
JAVA to JDBC to AS/400 Problem
a mistake for bean
Lost properties
Cannot load JDBC driver class 'null' ... WTF?
Connection pooling using Tomcat