|
Tip of the day: IBM Java Toolbox Record Level I/O
from Servlets
One of the benefits of doing record level i/o on an as/400
instead of jdbc is that the toolbox is smart enough to use direct database
access if you are on the as/400 instead of going through tcp/ip sockets.
This is a big potential speed improvement. However, if you are doing
toolbox record level i/o from within servlets in websphere, you may not be
seeing this benefit. The toolbox may still be going through the tcp/ip
stack.
Long answer
Before I explain how to fix the problem, you can check to see
for yourself by turning on the toolbox traces in your servlet. Put
something like this in your servlet prior to your
connectService(AS400.RECORDACCESS) statement:
try
{Trace.setFileName("ToolbxTr.log");} catch(Exception e){} Trace.setTraceWarningOn(true); Trace.setTraceInformationOn(true); Trace.setTraceErrorOn(true); Trace.setTraceDiagnosticOn(true); Trace.setTraceDatastreamOn(true) ; Trace.setTraceConversionOn(true); Trace.setTraceOn(true); This should create a file called ToolbxTr.log. If you dont specify a path name you will most likely get the log in the root of your IFS. You may want to specify the file name as something like "/home/ToolbxTr.log". Run your servlet and then look in the trace file. You
definitely have the problem if you have a line like this in the log
file:
Wed Nov 10 08:27:36 GMT+00:00 1999
Requirements not met to use native optimizations: UserID does not match
local userid
This line means that the toolbox will go through tcp/ip
sockets for your database i/o even though the servlet is really on the
as/400. The problem is that the toolbox checks to see if the userprf you
used in making the toolbox connection is the same as the owner of the job
running the servlet. For websphere this means that you must connect to the
as/400 using the QTMHHTTP user profile like so (of course substituting the
correct system name and password):
AS400 host = new
AS400("MYSYSNAME","QTMHHTTP","PASSWORD");
try{host.connectService(AS400.RECORDACCESS);} catch(Exception e){}
Now if you run the same traces on your servlet you should
see two lines like this in the log file:
Wed Nov 10 13:32:55 GMT+00:00 1999 Using native optimizations Wed Nov 10 13:32:55 GMT+00:00 1999 No service connection necessary for native service: as-ddm short answer
Make sure your servlet connects to the as/400 with the
QTMHHTTP user profile.
|
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.