>   >> static String poolName    = "JDBCAS400"; // From Webmaster.
>
In my Websphere implementation, the poolName = "JdbcDb2".  It may be
different for the AS400.  Check the values in connmgr.properties file to see
what are available.

Also double check all the other string values for the database stuff.
- Tom
[EMAIL PROTECTED]


> ----------
> From:         Ben Dudley[SMTP:[EMAIL PROTECTED]]
> Reply To:     Ben Dudley
> Sent:         Thursday, September 09, 1999 11:00 AM
> To:   [EMAIL PROTECTED]
> Subject:      Re: Help  - all Websphere Servlet/JSP developers
>
> I still can't get the connection pooling manager to work. Any suggestions?
>
> Thanks,
>
> Ben Dudley
>
>
> --------------------------------------------------------------------------
> --------------------------------------------------------------------------
> --------------------------------------------------------------------------
> --------------
>
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.sql.*;
> import java.util.*;
> import com.ibm.servlet.connmgr.*;
>
>
> public class AS400Conn extends HttpServlet  {
>
>    static IBMConnMgr connMgr = null;
>
>    // Use later in init() to create JDBC connection specification.
>    static IBMConnSpec spec   = null;      // The spec.
>    static String db          = "*******";      // Database name.
>    static String subprotocol = "as400";     // JDBC DB2 subprotocol.
>    static String poolName    = "JDBCAS400"; // From Webmaster.
>    static String jdbcDriver  = "COM.ibm.AS400.ACCESS.AS400JDBCDriver";
>    static String url         = null;      // Constructed later.
>    static String userid      = "*******";      // Userid and password can
>    static String password    = "*******";      // come from HTML form.
>   }
> }
>
>
> --------------------------------------------------------------------------
> ---------------------------------------------------------------
>
> public void init(ServletConfig config) throws ServletException
>    {
>    super.init(config);
>
>   url = "jdbc:as400://" + "******";
>
>  try {
>
>     java.sql.DriverManager.registerDriver(new
> com.ibm.as400.access.AS400JDBCDriver());
>
>   // Load (and therefore register) the Access Driver
>     Class.forName("com.ibm.as400.access.AS400JDBCDriver");
>
>    // Create JDBC connection specification.
>     spec = new IBMJdbcConnSpec
>     (poolName,    // pool name from Webmaster
>      true,        // waitRetry
>      jdbcDriver,  // Remaining four
>      url,         // parameters are
>      userid,      // specific for a
>      password);   // JDBC connection.
>
>   // Get a reference to the connection manager.
>    connMgr = IBMConnMgrUtil.getIBMConnMgr();
>
>    // Get a Connection to the database
>     conn = DriverManager.getConnection(url, userName, password);
>
>    }
>  catch (ClassNotFoundException e) {
>    throw new UnavailableException(this, "Couldn't load database driver");
>  }
>  catch (SQLException e) {
>   throw new UnavailableException(this, "Couldn't get db connection");
>  }
>
>    }
>
> --------------------------------------------------------------------------
> ----------------------------------------------------------
>
>   public void doGet(HttpServletRequest req, HttpServletResponse res)
>    {
>    IBMJdbcConn cmConn   = null;
>    Connection dataConn  = null;
>    Vector firstNameList = new Vector();
>    try
>    {
>
>    cmConn = (IBMJdbcConn)connMgr.getIBMConnection(spec);
>
>    dataConn = cmConn.getJdbcConnection();
>
>    Statement stmt = dataConn.createStatement();
>
>    try {
>
>    String query = "SELECT * FROM GISFACT WHERE PCUNIT = 'SA1 1AA'";
>
>    ResultSet rs   = stmt.executeQuery(query);
>
>   while(rs.next())
>    {
>    firstNameList.addElement(rs.getString(1));
>
>       }
>  catch(SQLException e) {
>    System.out.println("SQLException caught: " + e.getMessage());
>  }
>
>    }
>    catch(Exception e)
>    {
>    System.out.println("get connection, process statement: " +
>        e.getMessage());
>    }
>    finally
>    {
>    if(cmConn != null)
>    {
>    try
>    {
>       cmConn.releaseIBMConnection();
>    }
>    catch(IBMConnMgrException e)
>    {
>       System.out.println("release connection: " + e.getMessage());
>    }
>    }
>    }
>    // **********
>    // * STEP 7 *
>    // **********
>    // Prepare and return HTML response - say Hello to everyone
>    // whose last name is 'Parker' and address them with their first
>    // and last name.
>    res.setContentType("text/html");
>    // Next three lines prevent dynamic content from being cached
>    // on browsers.
>    res.setHeader("Pragma", "no-cache");
>    res.setHeader("Cache-Control", "no-cache");
>    res.setDateHeader("Expires", 0);
>    try
>    {
>    ServletOutputStream out = res.getOutputStream();
>    out.println("<HTML>");
>    out.println("<HEAD><TITLE>" + "empty" + "</TITLE><HEAD>");
>    out.println("<BODY>");
>
>    {
>    for(int i = 0; i < firstNameList.size(); i++)
>    {
>       out.println("<H1>" + "greeting" + " " +
>          firstNameList.elementAt(i) +
>          " Parker</H1>");
>    }
>    }
>    out.println("</BODY></HTML>");
>    out.close();
>    }
>    catch(IOException e)
>    {
>    System.out.println("HTML response: " + e.getMessage());
>    }
>    }
>
>
>
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to