Here's my code:
<%@ page import="java.sql.*" %>
<%
String connectionURL =
"jdbc:as400://MYAS400;user=will;password=bananas";
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
%>
<html><body>
<%
Class.forName("com.ibm.as400.access.AS400JDBCDriver").newInstance();
connection = DriverManager.getConnection(connectionURL);
statement = connection.createStatement();
rs = statement.executeQuery("SELECT * FROM myfile");
while (rs.next()) {
out.println(rs.getString("column1")+"<br>");
}
rs.close();
%>
</body></html>
Also how do I go about specifying the default library list?
Thanks in advance, Will
http://www-912.ibm.com/j_dir/JTOpen.nsf/By+Date?OpenView
and a home page at
http://www-124.ibm.com/developerworks/oss/jt400/
that contains a FAQ, documentation, ...
I may be able to help you with some of your questions
1. Don't forget to close your statement.
2. I believe libraries can be specified using
"libraries=LIB1,LIB2,*LIBL,LIB3" with commas or spaces separating the
libraries. This is a common question and can probably be found in the
documentation, FAQ or discussion group.
3. As far as no data, here are some things I can think of to check:
- You should have a "try {} catch {}" block to catch SQL exceptions
that may be thrown by the java.sql package. Maybe there's an error being
thrown and generically caught by Tomcat (maybe Tomcat logs have
something?) but your JSP should catch and handle it as it should close
resources it has already obtained.
- Can your PC ping MYAS400?
- Are TCP and Host services running on MYAS400?
- I don't use "newInstance()" after "Class.forName()" but I don't think
that makes a difference
- If it still doesn't work you may have to turn on Toolbox tracing and
weed through the messages
-Stevers
You are not supplying the user and password on the connection e.g.
connection = DriverManager.getConnection(connectionURL,user,password);
I guess thats why it's hanging.
I don't know about the library list, I always use the schema name as the
sign on name.
Mutley
"Will" <will_w...@hotmail.com> wrote in message
news:8425110c.02030...@posting.google.com...
--
Kent Milligan, DB2 & BI team
PartnerWorld for Developers, iSeries
km...@us.removethis.ibm.com GO HAWKEYES!!
>>> www.iseries.ibm.com/db2
(opinions stated are not necessarily those of my employer)