D
Drew
Hi All:
I have taken a standalone Java program that I can run from a command
prompt and succesfully execute a query and retrieve data from the 400.
I'm using the AS400JDBCDriver kit that can be downloaded and all I had
to do was to add a reference to the zip file to my Classpath.
I'm now trying to get the same program to work as a web application
under Tomcat 4. I already have other web apps working succesfully
under Tomcat 4. I've converted the Java program over to a Java
servlet.
I think my problem is getting the Java servlet to see the AS400 data
source whereas the standalone Java program was able to see it as soon
as I set the classpath environment variable correctly.
I have dropped 'jt400.jar' into the C:\Program Files\Apache
Group\Tomcat 4.1\common\lib folder
Then, in C:\Program Files\Apache Group\Tomcat 4.1\conf\server.xml, I
have added the following after the last </context> and before </host>.
<Resource name="jdbc/as400" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/as400">
<parameter>
<name>username</name>
<value>USERNAME</value>
</parameter>
<parameter>
<name>password</name>
<value>PASSWORD</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.ibm.as400.access.AS400JDBCDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:as400://172.16.1.2/javatest</value>
</parameter>
</ResourceParams>
When I try to execute this particular servlet, the Apache Tomcat
service gets stopped by whatever is wrong, and hence the page times
out after a bit and I get the Page Not Found Error.
All my existing servlets still work though. This is the first servlet
I've written to try and pull data from the AS400. All previous ones
pull data from Access databases which are set up as Data Sources under
control panel.
I've used my correct USERNAME and PASSWORD in server.xml above where
indicated.
The third line from the bottom has the IP address for the AS400 host
which is correct.
I am unclear on the word immediately following the host IP or name
though. I found the below guide:
<value>jdbc:as400://<$YOUR_HOST>/<$YOUR_COLLECTION></value>
It calls javatest a 'collection'. I'm not sure what is needed here.
I tried 'javatest' which obviously doesn't work.
I think my problem is just getting Tomcat to be able to see and access
the 400 datasource during the run of the servlet.
From what I've read, I'm thinking that all I needed to do was drop
the jt400.jar file into the common\lib folder and then go and put the
above stuff about the 400 in the server.xml file.
Can anyone provide any insight into where I'm goofing up?
Thanks very much!!!
Drew
I have taken a standalone Java program that I can run from a command
prompt and succesfully execute a query and retrieve data from the 400.
I'm using the AS400JDBCDriver kit that can be downloaded and all I had
to do was to add a reference to the zip file to my Classpath.
I'm now trying to get the same program to work as a web application
under Tomcat 4. I already have other web apps working succesfully
under Tomcat 4. I've converted the Java program over to a Java
servlet.
I think my problem is getting the Java servlet to see the AS400 data
source whereas the standalone Java program was able to see it as soon
as I set the classpath environment variable correctly.
I have dropped 'jt400.jar' into the C:\Program Files\Apache
Group\Tomcat 4.1\common\lib folder
Then, in C:\Program Files\Apache Group\Tomcat 4.1\conf\server.xml, I
have added the following after the last </context> and before </host>.
<Resource name="jdbc/as400" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/as400">
<parameter>
<name>username</name>
<value>USERNAME</value>
</parameter>
<parameter>
<name>password</name>
<value>PASSWORD</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.ibm.as400.access.AS400JDBCDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:as400://172.16.1.2/javatest</value>
</parameter>
</ResourceParams>
When I try to execute this particular servlet, the Apache Tomcat
service gets stopped by whatever is wrong, and hence the page times
out after a bit and I get the Page Not Found Error.
All my existing servlets still work though. This is the first servlet
I've written to try and pull data from the AS400. All previous ones
pull data from Access databases which are set up as Data Sources under
control panel.
I've used my correct USERNAME and PASSWORD in server.xml above where
indicated.
The third line from the bottom has the IP address for the AS400 host
which is correct.
I am unclear on the word immediately following the host IP or name
though. I found the below guide:
<value>jdbc:as400://<$YOUR_HOST>/<$YOUR_COLLECTION></value>
It calls javatest a 'collection'. I'm not sure what is needed here.
I tried 'javatest' which obviously doesn't work.
I think my problem is just getting Tomcat to be able to see and access
the 400 datasource during the run of the servlet.
From what I've read, I'm thinking that all I needed to do was drop
the jt400.jar file into the common\lib folder and then go and put the
above stuff about the 400 in the server.xml file.
Can anyone provide any insight into where I'm goofing up?
Thanks very much!!!
Drew