|
I keep getting the following error when I try to run this JSP "" com.sun.jsp.JspException: Compilation failed"" I included the code hopefully I am missing something simple. I have changed the system name and the userid and password fields. I was wondering if there might be an authority issue. I am using WebSphere 3.02.2 on an AS/400 V4R5... Thanks in advance. <html><body><h2>Authors</h2> <%@ page import="java.sql.*"%> <%! Connection con = null;%> <%! String system = "AS/400/LIB"; %> <%! String userId = "USERID"; %> <%! String password = "PASSWORD"; %> <%! String url = "jdbc:db2://" + system; %> <%! public Connection getConnection() { if(con != null) (return con;) try { Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"); con = DriverManager.getConnection( url, userId, password); } catch(Exception e) { System.out.println("Error retreiving connection:" + e); return null; } return con; } %> <% con = getConnection(); if(con == null) { System.out.println("Sorry Database is not available."); return; } try { Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("Select * from LIB.AUTHORS"); <table border=1 cellpadding=5> <th>Author ID</th><th>First Name</th><th>Last Name</th> <th>Year Born</th> <% while(rs.next()) { %> <tr> <td><%=rs.getString("AUTHORID")%></td> <td><%=rs.getString("FIRSTNAME")%></td> <td><%=rs.getString("LASTNAME")%></td> <td><%=rs.getString("YEARBORN")%></td> </tr> <% } // while(rs.next()) %> </table> <% rs.close(); stmt.close(); } catch(SQLException e) { System.out.println("SQL error: " + e); } %> </body></html> +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +---
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.