I am very like jive 1.3 but when
I used Websphere 3.5 ADV for Win2000 and DB2 V7.1
get error message
Thu Dec 14 11:54:50 CST 2000 Opening connection 39
DB2Connection
{
connectionHandle = 42
SPConnected = false
source = JIVE
user = db2admin
conArgs =
closed = false
describeCached = false
describeParam = true
isReadOnly = false
autoClose = false
}
:
> Connections Exhausted! Will wait and try again in loop 1
> Could not free connection!!!
Unable to create new connection: COM.ibm.db2.jdbc.DB2Exception: IBM[CLI Driver] SQL1040N ÃëÃý¾Ã¿âÃà õÃæÃóÃÃòÃôﵽÃî´óÃýÿ¡£ SQLSTATE=57030
It's connpool not close ?
I must restart server
please help me
thanks
hwg
try using something like this for connection pool and set up the database connection in websphere
package com.coolservlets.forum.database;
import java.sql.*;
import java.util.*;
import java.io.*;
import java.text.*;
import java.util.Date;
import com.coolservlets.forum.*;
import com.ibm.db.;import com.ibm.ejs.dbm.jdbcext.;
import com.ibm.ejs.ns.jndi.;import javax.naming.;
import com.ibm.websphere.advanced.cm.factory.*;
import javax.sql.DataSource;import com.ibm.webtools.runtime.*;
import java.math.;/*
Default Jive connection provider. It uses the excellent connection pool
available from http://www.javaexchange.com. This connection provider is a
a good choice unless you can use a container-managed one.
*/
public class DbConnectionWebSpherePool extends DbConnectionProvider {
//end Websphere
private static final String NAME = "Default Connection Pool";
private static final String DESCRIPTION = "The default connection provider "
+ "that uses the connection pool from javaexchange.com. It works with "
+ "almost any database setup, is customizable, and offers good performance. "
+ "Use this connection provider unless you have your own or can use a "
+ "container managed connection pool.";
private static final String AUTHOR = "CoolServlets.com";
private static final int MAJOR_VERSION = 1;
private static final int MINOR_VERSION = 0;
private static final boolean POOLED = true;
private Properties props;
private Properties propDescriptions;
private Object initLock = new Object();
/**
Returns a database connection.
*/
public Connection getConnection() {
try
{
if(notstarted)
this.start();
Connection conn = ds.getConnection(props.getProperty("username"), props.getProperty("password"));
return conn;
}
catch(java.sql.SQLException e)
{
System.err.println("Error getting connection");
e.printStackTrace();
}
return null;
}
/**
Starts the pool.
*/
protected void start() {
//acquire lock so that no connections can be returned.
synchronized (initLock)
{
try
{
Hashtable parms = new Hashtable();
parms.put(Context.INITIAL_CONTEXT_FACTORY, props.getProperty("initialcontext"));
Context ctx = new InitialContext(parms);
ds = (DataSource)ctx.lookup(props.getProperty("datasource"));
notstarted = false;
}
catch (javax.naming.NamingException e)
{
System.err.println("Error: could not get initial context");
e.printStackTrace();
return;
}
}
}
/**
Restarts the pool to take into account any property changes.
*/
protected void restart() {
//Kill off pool.
destroy();
//Reload properties.
loadProperties();
//Start a new pool.
start();
}
/**
Destroys the connection pool.
*/
protected void destroy() {
}
/**
Returns the value of a property of the connection provider.
*
@param name the name of the property.
@returns the value of the property.
*/
public String getProperty(String name) {
return (String)props.get(name);
}
/**
Returns the description of a property of the connection provider.
*
@param name the name of the property.
@return the description of the property.
*/
public String getPropertyDescription(String name) {
return (String)propDescriptions.get(name);
}
/**
Returns an enumeration of the property names for the connection provider.
*/
public Enumeration propertyNames() {
return props.propertyNames();
}
/**
Sets a property of the connection provider. Each provider has a set number
of properties that are determined by the author. Trying to set a non-
existant property will result in an IllegalArgumentException.
*
@param name the name of the property to set.
@param value the new value for the property.
*
*/
public void setProperty(String name, String value) {
props.put(name, value);
saveProperties();
}
/**
Give default values to all the properties and descriptions.
*/
private void initializeProperties() {
props.put("datasource","");
props.put("username","");
props.put("password","");
props.put("initialcontext","");
propDescriptions.put("datasource","Name of the datasource as created in WebSphere");
propDescriptions.put("username","Database username. e.g. 'Scott'");
propDescriptions.put("password","Database password. e.g. 'Tiger'");
propDescriptions.put("initialcontext","Class for intial context com.ibm.ejs.ns.jndi.CNInitialContextFactory");
}
/**
Load whatever properties that already exist.
*/
private void loadProperties() {
String datasource = PropertyManager.getProperty("DbConnectionDefaultPool.datasource");
String username = PropertyManager.getProperty("DbConnectionDefaultPool.username");
String password = PropertyManager.getProperty("DbConnectionDefaultPool.password");
String initialcontext = PropertyManager.getProperty("DbConnectionDefaultPool.initialcontext");
if (datasource != null) { props.setProperty("datasource", datasource); }
if (username != null) { props.setProperty("username", username); }
if (password != null) { props.setProperty("password", password); }
if (initialcontext != null) { props.setProperty("initialcontext", initialcontext); }
}
private void saveProperties() {
PropertyManager.setProperty("DbConnectionDefaultPool.datasource", props.getProperty("datasource"));
PropertyManager.setProperty("DbConnectionDefaultPool.username", props.getProperty("username"));
PropertyManager.setProperty("DbConnectionDefaultPool.password", props.getProperty("password"));
PropertyManager.setProperty("DbConnectionDefaultPool.initialcontext", props.getProperty("initialcontext"));
}
private Context ctx = null; private DataSource ds = null;
private boolean notstarted = true; //websphere
private Hashtable parms = null; public DbConnectionWebSpherePool() {
//this.manager = manager;
props = new Properties();
propDescriptions = new Properties();
//Initialize all property values
initializeProperties();
//Load any existing property values
loadProperties();
}}
Does the currently included DataSource connection provider not work for you? If not, I'd like to find out why so that it can get fixed. ![]()
Thanks,
Matt
hwg,
We're very careful to make sure that all connections are released... even if there are database errors. I'm very interested in tracking down the problem in your environment, as we take exaughsted connection pools pretty seriously. Are there any other errors showing up in your error log?
Thanks,
Matt
hi Matt:
I am so glad to see u reply ,Now I am useing Datasource for Websphere and add u suggest
please wait I will told u errlog
I found some error when testing.
if I click search button get error
Error 500
´¦ÃÃÃëÃóñ³ö´Ã£ºhttp://hwg/skins/bay/search.jsp
Ãû⣺ Compilation failed
ÿ±êá·þÃñ³ÃÃò£º jsp10
¶Ãû¸úÃãº
¸ù±¾´ÃÃó-1: Compilation failed
com.ibm.servlet.engine.webapp.WebAppErrorReport: Compilation failed
at javax.servlet.ServletException.<init>(ServletException.java:107)
at com.ibm.websphere.servlet.error.ServletErrorReport.<init>(ServletErrorReport.java:31)
at com.ibm.servlet.engine.webapp.WebAppErrorReport.<init>(WebAppErrorReport.java:20)
at com.ibm.servlet.engine.webapp.WebAppDispatcherResponse.sendError(WebAppDispatcherResponse.java:97)
at com.sun.jsp.runtime.JspServlet.unknownException(JspServlet.java:656)
at com.sun.jsp.runtime.JspServlet.service(JspServlet.java:768)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:580)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:160)
at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:287)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:105)
at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:353)
at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:729)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:655)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:338)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:175)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:93)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:77)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:155)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:300)
at com.ibm.servlet.engine.oselistener.SQEventListenerImp$ServiceRunnable.run(SQEventListenerImp.java:230)
at com.ibm.servlet.engine.oselistener.SQEventListenerImp.notifySQEvent(SQEventListenerImp.java:104)
at com.ibm.servlet.engine.oselistener.serverqueue.SQEventSource.notifyEvent(SQEventSource.java:212)
at com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRunnable.notifyService(SQWrapperEventSource.java:347)
at com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRunnable.run(SQWrapperEventSource.java:216)
at com.ibm.servlet.engine.oselistener.outofproc.OutOfProcThread$CtlRunnable.run(OutOfProcThread.java:248)
at java.lang.Thread.run(Thread.java:481)
Jive combines collaboration software, community software & social networking software into the leading SBS solution.
© Copyright 2000–2009 Jive Software. All rights reserved.
915 SW Stark St., Suite 400, Portland, OR 97205