Formula to count Number of Connection Pools
Hello Folks,
1. i heard that there is a formula for selecting number of connection pools, what is it please
2. how can we implement user security in connection pools based on users
3. what other users exists in presentation services other than users in repository services, and if we need to give the control to users for presentation services, where shall we give it.
thank you
kumar
1. i heard that there is a formula for selecting number of connection pools, what is it pleaseI don't know about a formula as such, but you can get this kind of data via the Systems Management function of OBIEE
http://rnm1978.wordpress.com/2009/07/22/oracle-bi-management-systems-management-mbeans/
Maybe there's an undocumented ODBC call that BI Server supports to reveal this kind of information??
Similar Messages
-
Maximum number of connection pools?
Hello,
I'm running WL 5.1, sp11 on Solaris with Oracle 8.1.7. I was
wondering, is there a maximum number of connection pools allowed by
weblogic? Or does it not matter so long as the sum of all the max
connections in each pool is less than the max connections oracle will
let you make simultaneously?
Thanks, DaveHi. There is no limit to the number of pools weblogic will let you
make. The number of connections Oracle will let you have is
between them and you. :-)
Joe
"D. Alvarado" wrote:
Hello,
I'm running WL 5.1, sp11 on Solaris with Oracle 8.1.7. I was
wondering, is there a maximum number of connection pools allowed by
weblogic? Or does it not matter so long as the sum of all the max
connections in each pool is less than the max connections oracle will
let you make simultaneously?
Thanks, Dave -
Hi,
I would like to know if it's possible to count the number of distinct users connecting on a database during a day.
Thank youThank you very much. It was a good idea.
I created a trigger :
CREATE OR REPLACE TRIGGER logon_audit AFTER LOGON ON DATABASE
BEGIN
insert into log_info values(sysdate,SYS_CONTEXT('USERENV','SESSION_USER'),
SYS_CONTEXT('USERENV','IP_ADDRESS'), SYS_CONTEXT('USERENV','CLIENT_INFO'), 'SUCCESSFUL');
END; -
Calculation of no of connection pools required...
hi,
1. How many connections can a connection pool have? is there any upper limit on it?
2. How do we calculate how many connection pools we need for good performance in our OBIEE system.
3. Currently my client have plans to launch this application for 5,000 users and later after few months the same application will be opened for 70,000 users. So how should i calculate the number of connection pools required so that all the users can acces the Dashboard without feeling much network traffic (assuming all the users are logged in same time)
Any suggestions guys?Hi Abhi,
To calculate maximum no of connections go through the gerard nico link that Srikanth has provided.Generally for init blocks and report queries we creat diffrent connection pools.
No of connection pools and max no of connections should be carefully chosen because BI server will allocate memory to these connection even if you are not using those connection pools.Total no of connections in RPD should be less than 800.This is an Oracle recommnedation.
Regards,
Sandeep -
Getting the number of active connections in a connection Pool
Hi,
I have an application deployed on jboss. DB used is db2. For monitoring purpose i need to get the number of active and idle connections at any point of time. I am trying to use commons-dbcp jar to get this data using BasicDataSourceClass. Following is the piece of code.
Context initialContext;
try {
initialContext = new InitialContext();
DataSource ds = (DataSource) initialContext.lookup(myjndiname);
logger.info("************CONNECTION POOL DATA->" + ds.getClass().getName() + "************" + ds.getClass() + "**************");
BasicDataSource bds = (BasicDataSource) datasource;
logger.info("************CONNECTION POOL DATA-> ACTIVE CONN=" + bds.getNumActive() + " IDLE CONN=" + bds.getNumIdle() + " INIT SIZE=" + bds.getInitialSize());
catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
This code gave a class cast exception at the point datasource is cast to BasicDataSource. The class name returned by ds is WrapperDataSource. I have few queries on this:-
1. What configurations do i need so that datasource returned by InitialContext is BasicDataSource? FYI i tried to add the BasicDataSourceFactory in db2-ds.xml. But it still didnt work
2. Is there any other way to find the number of active connections in a connection pool? I dont want any server specific solution.
Pls help.
Thanksuser13642196 wrote:
Hi,
I have an application deployed on jboss. DB used is db2. For monitoring purpose i need to get the number of active and idle connections at any point of time. I am trying to use commons-dbcp jar to get this data using BasicDataSourceClass. Following is the piece of code.
Context initialContext;
try {
initialContext = new InitialContext();
DataSource ds = (DataSource) initialContext.lookup(myjndiname);
logger.info("************CONNECTION POOL DATA->" + ds.getClass().getName() + "************" + ds.getClass() + "**************");
BasicDataSource bds = (BasicDataSource) datasource;
logger.info("************CONNECTION POOL DATA-> ACTIVE CONN=" + bds.getNumActive() + " IDLE CONN=" + bds.getNumIdle() + " INIT SIZE=" + bds.getInitialSize());
catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}This code gave a class cast exception at the point datasource is cast to BasicDataSource. The class name returned by ds is WrapperDataSource. You can only cast an object to an interface it implements or to a class it extends (directly or indirectly).
I have few queries on this:-
1. What configurations do i need so that datasource returned by InitialContext is BasicDataSource? FYI i tried to add the BasicDataSourceFactory in db2-ds.xml. But it still didnt workhttp://commons.apache.org/dbcp/api-1.2.2/org/apache/commons/dbcp/package-summary.html#package_description -
Number of connections unused in a weblogic pool ?
Here is my question :
Do you know a way to know the number of connections unused (or the number of connections in use) at a particular moment in a weblogic connection pool ?
Thanks a lot !
And sorry for my poor english...
Jerome.Presumably this is for server monitoring rather than because you are going to do anything with it in the server itself.
If it was mea I would look in the management interface. You might have to drill down a bit and just plain guess. -
Number of connections in JSP with pool cache connection
I'm using a Bean from examples, its name: "ods", this is Pool Connection Cache, when a user start connection, this open 10 connections. In my project works 20 users, the DBA prefers don't use too many connections. The version of DB is 8.1.7 and web server 9iAS.
How do I do?
Can I use other number of connections by session?
What is the most rapid connection for work?
The instruction used is:
<jsp:useBean id="ods" class="oracle.jdbc.pool.OracleConnectionCacheImpl" scope="session" />
Thanks
MIGUEL ANGEL CARO
[email protected]Hi,
Please repost your question in the J2EE forum. This forum is for Web Cache issues only. Sorry about the confusion.
We'll be changing the title of this forum soon to avoid mispostings. -
Number of connections with JSP pool cache
I'm using a Bean from examples, its name: "ods", this is Pool Connection Cache, when a user start connection, this open 10 connections. In my project works 20 users, the DBA prefers don't use too many connections. The version of DB is 8.1.7 and web server 9iAS.
How do I do?
Can I use other number of connections by session?
What is the most rapid connection for work?
The instruction used is:
<jsp:useBean id="ods" class="oracle.jdbc.pool.OracleConnectionCacheImpl" scope="session" />
Thanks
MIGUEL ANGEL CARO
[email protected]Hi,
Please repost your question in the J2EE forum. This forum is for Web Cache issues only. Sorry about the confusion.
We'll be changing the title of this forum soon to avoid mispostings. -
Number of connections in a JDBC pool
Hi,
I am running Sun One Webserver 6.1SP4 on Solaris 8 on sparc machines. My web app interacts with Oracle 9.2 using the web server's jdbc pooling mechanism. Everything works fine, but what worries me is the number of connections always goes up even during nights when the traffic is considerably low compared to day time. Here is part of my server.xml relevant to the pool.
<JDBCCONNECTIONPOOL name="spfc-dbp1" datasourceclassname="oracle.jdbc.pool.OracleDataSource" steadypoolsize="8" maxpoo
lsize="80" poolresizequantity="8" idletimeout="300" maxwaittime="10000" connectionvalidationrequired="on" connectionvalidati
onmethod="auto-commit" validationtablename="" failallconnections="off" transactionisolationlevel="read-committed" isolationl
evelguaranteed="on">
I checked all my code to make sure I am calling close() on result sets, statements and the connection itself both immediately after completing work as well as in the finally blocks.
The only mechanism I have to bring down the number of connections is to restart the web server. I played around with the poolresizequantity, idletimeout properties, but it didn't help much.
I thank all of you in advance for any insights.
-SharmaHi Sharma,
I have a similar problem.
Starting my portal and it works for about ten minutes. Then it is unreachable, because of an ProfileException error. I guess it is too many DB Connections.
I can do 2 things:
- wait for about 20minutes and it works again for ten minutes, or
- restart tomcat.
Currently I am setting up a new Connection Pool, Jdbc2Pool.
Did you find a solution to your problem?
Ciao,
Axel -
How do I configure the number of connection in the pool for webservice axis
Hi
How do I configure the number of connection in the pool using xml.
We are using axis 1.4 and commons-httpclient-3.0.1Is there any way we can do it using the client-config.wsdd file.
We do not want to do any modification in the code for this.
Is it possible to set socket timeout also in the wsdd file.
Your resolution will be really helpful for us.
Thank You
OttranExport them at a smaller size:
File -> Export - not the options at 'Size'
Regards
TD -
RFC_FAILURE affects Connection Pool
Using VB.NET (2003) with .Net Connector 2.0.
An intermittent problem causes a RFC Call to fail, and an exception is raised in the .NET code. The Exception message is:
See RFC trace file or SAP system log for more details
The Trace file shows:
ERROR file opened at 20051115 131423 GMT Standard
T, SAP-REL 640,0,78 RFC-VER 3 759904 MT-SL
<b>T:2844 Could not send rfc container 0x130
T:2844 <* RfcCall [1] : returns 1:RFC_FAILURE
T:2844 <* RfcCallReceive [1] : returns 1:RFC_FAILURE
>TS> Tue Nov 15 13:14:24 2005
T:2844 <* RfcCleanupContext [1] : returns
18:RFC_INVALID_HANDLE
T:2844 <* RfcCleanupContext [1] : returns
18:RFC_INVALID_HANDLE</b>
This error adversely affects the Connection Pool as calls to other RFCs are now prone to similar intermittent errors
Is there any way to prevent the problem causing problems with Connection Pool ?
Is there any way of removing a faulty connection from the pool ? (NB Close and Dispose on the connection does not help)The application is a Windows service - so I don't want to lose any connections. I assume that closing the connection (and not returning it) will affect the number of available connections in the pool(?).
I'm using async. RFC call, and the problem is detected in the callback function when the EndRFCCall is performed.
Original code:
Public Sub Execute_RFC(ByVal parameters as string())
' Assign SAP Connection to RFC Proxy
sapRFCProxy.Connection = SAPConnectionPool.GetConnectionFromPool(<i>ConnectString</i>)
Call the SAP RFC - Asynchronously
arAsyncResult = m_sapRFCProxy.BeginRFCCall( params..., AddressOf RFC_CallBack, objAsyncState)
End Sub
Private Sub RFC_CallBack(ByVal ar As IAsyncResult)
Try
' Retrieve the SAP RFC Response...
Call sapRFCProxy.EndRFCCall(ar, <i>param1, param2, etc...</i>)
Catch ex As Exception
' Log the Error...
End Try
' Return the Connection
Call SAPConnections.ReturnConnection(sapRFCProxy.Connection)
End Sub
I have changed the code as suggest so that the connection is closed, disposed but <u>not</u> returned. This cleared the RFC_INVALID_HANDLE errors, but the main problem of a corrupted connection persists.
Diagnostics produced by the amended code:
<u>Trace File (Info):</u>
2005-11-16 11:55:46Z Warning: RfcCleanupContext failed. Closing connection
<u>dev_RFC.trc</u>
ERROR file opened at 20051116 115546 GMT Standard T, SAP-REL 640,0,78 RFC-VER 3 759904 MT-SL
T:3068 ======> CPIC-CALL: 'CMSEND'
ERROR program state check for conversation 99610798
TIME Wed Nov 16 11:55:46 2005
RELEASE 640
COMPONENT CPIC (TCP/IP)
VERSION 3
RC 471
MODULE r3cpic.c
LINE 2576
DETAIL called function STSEND in state state=BUFFER_DATA2
COUNTER 1
T:3068 <* RfcCall [20] : returns 1:RFC_FAILURE
T:3068 <* RfcCallReceive [20] : returns 1:RFC_FAILURE
T:3068 <* RfcCleanupContext [20] : returns 1:RFC_FAILURE
Even with the change to the code, a call to a reliable RFC will now fail <u>intermittently</u> with:
T:2876 Could not send rfc container 0x130
T:2876 <* RfcCall [24] : returns 1:RFC_FAILURE
T:2876 <* RfcCallReceive [24] : returns 1:RFC_FAILURE
Thanks -
Oc4j connection pool: too much INACTIVE connections
I am publishing an application - developed using Eclipse and previously published in Tomcat (where it works perfectly for a long time) - within corporate servers using Oc4j version 10.1.3. The database server is Oracle 9g.
After the deployment operation, the application seems to work, but that happens during the work by users, there are still many connections whith status "INACTIVE", until to complete all the available connections.
The datasource is set as follows:
<connection-pool name="ConnectionPoolRichiestaPubblicazione">
<connection-factory factory-class="oracle.jdbc.pool.OracleDataSource"
user="REDAZIONE"
password="password"
url="jdbc:oracle:thin:@(DESCRIPTION=(FAILOVER=ON)
(ADDRESS_LIST=(LOAD_BALANCE=ON)
(ADDRESS=(PROTOCOL=TCP)
(HOST=10.146.2.86)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=10.146.2.86)(PORT=1521)))
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=XE)
(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(RETRIES=180)(DELAY=5))))">
</connection-factory>
</connection-pool>
<managed-data-source
jndi-name="jdbc/RichiestaPubblicazioneDS"
name="RichiestaPubblicazioneDS"
connection-pool-name="ConnectionPoolRichiestaPubblicazione" />
The java code to establish a connection is as follows:
private Connection creaConnessioneDataSource(String nomedatasource) throws ConnessioneException{
LOGGER.debug("START");
try {
InitialContext context = new InitialContext();
DataSource ds = (DataSource)context.lookup(nomedatasource);
LOGGER.debug("URL DATASOURCE : " + ds.getConnection().getMetaData().getURL());
LOGGER.debug("USERNAME : " + ds.getConnection().getMetaData().getUserName());
this.conn = ds.getConnection();
catch( Exception e ) {
LOGGER.error("Errore nella connessione tramite datasource : " + StringUtils.getCustomStackTrace(e));
LOGGER.debug("END");
return this.conn;
Connections and statements are closed using the following methods:
public boolean chiudi(Connection conn){
LOGGER.debug("START");
boolean esito = false;
if (conn != null){
try {
conn.close();
esito = true;
LOGGER.debug("Connessione chiusa");
catch (SQLException e) {
LOGGER.error("Eccezione nella chiusura della connessione : " + e);
LOGGER.debug("END");
return esito;
public boolean chiudi(Statement stmt){
LOGGER.debug("START");
boolean esito = false;
if (stmt != null){
try {
stmt.close();
esito = true;
LOGGER.debug("Statement chiuso");
} catch (SQLException e) {
LOGGER.error("Eccezione nella chiusura dello statement : " + e);
e.printStackTrace();
LOGGER.debug("END");
return esito;
Here are a couple of examples of code that interact with the database:
public List<StatoRichiestaSintesi> getElencoStatiRichieste() throws ConnessioneException{
LOGGER.debug("START");
List<StatoRichiestaSintesi> listaStati=new LinkedList<StatoRichiestaSintesi>();
LOGGER.debug("Apriamo connessione e statement");
Connection conn = databaseManager.creaConnessioneDataSource(datasource);
Statement stmt = databaseManager.creaStatement(conn, false);
String sql="SELECT * FROM STATORICHIESTA";
try {
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()){
StatoRichiestaSintesi temp=new StatoRichiestaSintesi();
temp.setIdStato(rs.getString(1));
temp.setDescrizioneStato(rs.getString(2));
listaStati.add(temp);
LOGGER.debug("Numero record trovati : " + listaStati.size());
} catch (SQLException e) {
LOGGER.error("Eccezione di tipo SQL : " + StringUtils.getCustomStackTrace(e));
finally{
LOGGER.debug("Chiusura di statement e connessione");
databaseManager.chiudi(stmt);
databaseManager.chiudi(conn);
LOGGER.debug("END");
return listaStati;
Below is another example using PreparedStatement:
private synchronized void aggiungiIndicazioneProgetto(String idprogetto, String idrichiesta) {
LOGGER.debug("START");
LOGGER.debug("Creo un oggetto di tipo connessione");
Connection conn = databaseManager.creaConnessioneDataSource(datasource);
LOGGER.debug("Definisco una query sql");
String sql = "INSERT INTO RICHIESTAPROGETTO (IDRICHIESTA,IDPROGETTO) VALUES (?,?)";
LOGGER.debug("Dichiaro un oggetto di tipo preparedstatement");
PreparedStatement stmt = null;
try {
LOGGER.debug("Istanzio l'oggetto statement");
stmt = conn.prepareStatement(sql);
LOGGER.debug("Imposto i segnalibri della query");
stmt.setString(1, idrichiesta);
stmt.setString(2, idprogetto);
LOGGER.debug("Eseguo la query di inserimento del progetto");
stmt.executeUpdate();
} catch (SQLException e) {
LOGGER.error("Eccezione di tipo SQL : " + StringUtils.getCustomStackTrace(e));
finally {
LOGGER.debug("Chiusura di statement e connessione");
databaseManager.chiudi(stmt);
databaseManager.chiudi(conn);
LOGGER.debug("END");
Which may be the cause for the described behavior?
I hope someone help me..My problem is the following.
If I deploy my application with the illustred datasource in my local OC4J (10.1.3 in a Standalone Environment) all work fine.
The application creates a reasonable number of connections (in ORACLE - 10g Enterprise Edition Release 10.2.0.4.0 - db I run the query verification "select count(*) from v$session where username='MYAPPLICATION'"), and overall performance is very good.
If, however, to deploy on the production machine of corporate (always 10.1.3, but obviously in Oracle Application Server Environment) the
number of connections (status 'INACTIVE') grows massively, and this is saturated in a short time.
The exception that at the end from the application is that:
java.sql.SQLException: ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:277)
oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
oracle.jdbc.driver.T4CTTIoauthenticate.receiveOsesskey(T4CTTIoauthenticate.java:243)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:304)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:430)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:151)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:608)
oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:218)
oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:114)
oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:77)
oracle.jdbc.pool.OracleImplicitConnectionCache.makeCacheConnection(OracleImplicitConnectionCache.java:1361)
oracle.jdbc.pool.OracleImplicitConnectionCache.getCacheConnection(OracleImplicitConnectionCache.java:441)
oracle.jdbc.pool.OracleImplicitConnectionCache.getConnection(OracleImplicitConnectionCache.java:336)
oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:286)
oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:179)
oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:159)
oracle.oc4j.sql.DataSourceConnectionPoolDataSource.getPooledConnection(DataSourceConnectionPoolDataSource.java:57)
oracle.oc4j.sql.xa.EmulatedXADataSource.getXAConnection(EmulatedXADataSource.java:92)
oracle.oc4j.sql.spi.ManagedConnectionFactoryImpl.createXAConnection(ManagedConnectionFactoryImpl.java:211)
oracle.oc4j.sql.spi.ManagedConnectionFactoryImpl.createManagedConnection(ManagedConnectionFactoryImpl.java:170)
com.evermind.server.connector.ApplicationConnectionManager.createManagedConnection(ApplicationConnectionManager.java:1377)
oracle.j2ee.connector.ConnectionPoolImpl.createManagedConnectionFromFactory(ConnectionPoolImpl.java:327)
oracle.j2ee.connector.ConnectionPoolImpl.access$800(ConnectionPoolImpl.java:98)
also I add the other attributes of Connection Pool of the Datasource:
Connections:
Initial size of Connection Cache = 0
Minimum Number of Connections = 0
Maximum Number of Connections = -1
Connection Retry Interval (seconds) = 1
Maximum Connection Attempts = 3
Maximum Number of Statements Cached = 0
Lower Threshold Limit On Pool (%)= 20
Validate Connection = False
What I can do?
many thanks.. -
Reuse of preparedstatements and the connection pool
It seems useful (for performance reasons) to reuse a prepared statement in
subsequent calls to the database. In WebLogic, however, after each call we
return the Connection object to the WebLogic connection pool. A prepared
statement is created on a specific Connection object. The next time we want
to use the same query we get a Connection from the pool, which might be
another instance of the Connection class. Therefor it seems impossible or at
least dangerous to reuse the same prepared statement. Even in the case this
would work we're indirectly using the other Connection, which we already
returned to the pool and which could be retrieved from the pool by someone
else. So, can't we reuse preparedstatements ?Hi Raja,
Currently the only bullet-proof way to make sure that all statements are
cached is to set the cache size to a number of possible prepared statements
in the application.
The only consequence of increased cache size is growing amount of
memory required by a server instance.
Regards,
Slava Imeshev
"Rajiv Jauhari" <[email protected]> wrote in message
news:[email protected]...
Is there an easy way to tell whether the prepared statement cache size one
has set is
appropriate? Some way to monitor cache hit rate or usage count (i.e., the
actual number of statements cached) while running a load test? I'm using
Weblogic 6.1sp3 and Oracle 8.1.7.4.
Another way to think of this question is: is there a negative impact ifthe
cache size is set too large?
In the case of Oracle I believe one might run out of cursors, but is there
any other negative consequence that you know of?
Thanks,
Rajiv
"Joseph Weinstein" <[email protected]> wrote in message
news:[email protected]...
Vyas wrote:
If multiples (of the same statement) can be cached would it not result
in too many
prepared statements of the same type in the cache ?
This could happen
1. When a load test is done when all the threads start doing exactly
the
same work.
Because of contention everybody gets their own statement copy(theoritically, even
if in practice it may not exactly happen like that). In such a case
you
are going
to create load on the database in terms of open cursors.Each thread will get it's own connection, and the statement cache isper-connection.
Cursors, in Oracle's case, do need to be configured to support acache-full of
retained statements. Alternately, the cache should be set to a smallenough size to
require only as many cursors as the DBMS will allow per connection.
Another issue is what happens when the cache limit is hit ?
In the above example let's say cache limit is 50 and I am doing 50
user
load test.
because of load test let's say the cache gets filled with 50 of the
same
statement.
When load test moves to the next sequence of action requiring a
diffrent
statement
what happens to the cache ?
thanks
VyasThe only way a given connection's statement cache will get a duplicatestatement
is if some single JDBC thread required multiple copies of the samestatement. A
multi-user test will usually just ensure that each pooled connectioncaches the
same selection of different statements that the test user used. If thetest user
just repeatedly makes and uses one statement, the first time they do it,the
statement will be cached, and every subsequent repeat of the user codewill get
the same cached statement. The cache will still have 49 empty slotswaiting for
different statements. Currently the cache is simple-minded. It is a
fixed
(configurable)
size per connection, and the first N prepared/callable statements getcached for the
life of the pooled connection that created them. All other subsequentstatements will
be made and closed on a per-connection-use basis. Therefore, it can bethat a startup
or stress load that runs before standard runtime service, and which usessignificantly
different a statement profile could populate the cache with rarely-usedwasted statements.
If I were a customer in this circumstance, I would either prime thecaches, by determining
which statements I wanted cached, and then running a startup class thatreserved all the
pool connections, and made these statements on each before closing them.Alternately,
after startup/stress I would reset the pool, and allow the runtime load
to
fill the cache of
the regenerated pool.
Joe Weinstein at B.E.A.
thanks
Vyas
Joseph Weinstein <[email protected]> wrote:
JS wrote:
It seems useful (for performance reasons) to reuse a prepared
statement
in
subsequent calls to the database. In WebLogic, however, after each
call
we
return the Connection object to the WebLogic connection pool. A
prepared
statement is created on a specific Connection object. The next timewe
want
to use the same query we get a Connection from the pool, which
might
be
another instance of the Connection class. Therefor it seemsimpossible
or at
least dangerous to reuse the same prepared statement. Even in the
case
this
would work we're indirectly using the other Connection, which we
already
returned to the pool and which could be retrieved from the pool bysomeone
else. So, can't we reuse preparedstatements ?We already have you covered! Weblogic caches PreparedStatements along
with the pooled connection they came from. Every time you obtain a
pool
connection and run a prepareStatement() or prepareCall(), we willtransparently
give you a previously made statement, if the SQL exactly matches, andno
other place in the current thread stack is using that statement(multiples
can
be cached)
You are correct, of course, that statements you have should only
be
useable
to you while you have the connection from which they came. We have
you
covered
there too. If you were to try to use any prepared statement that
you'd
gotten
from
a pool connection after you'd put the connection back into the pool,those
statements
would throw an exception saying that they had been made inoperable atthe
time
you'd closed the connection.
Joe Weinstein at B.E.A. -
I need help with socket connection pooling please
I need a basic connection pooling system for the code below users sets number connections 5 etc.
<main class>
s = new ListService(ssock.accept(),serverDir); //give list to client
Thread t = new Thread(s);
t.start();
<main class>
class ListService implements Runnable
Socket client;
String serverDir;
public ListService(Socket client,String serverDir)
this.client = client;
this.serverDir = serverDir;
public void run()
try
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(client.getOutputStream()));
// send something to client
catch(Exception e)
System.out.println(e);
System.out.println("client disconnected\n");
catch(Exception e){}
Thank you so muchMy code already accepts multi clients I need pooling only 5 clients can be using the server at a time when one client disconnects that means another incoming client can enter the pool to use the server.
I tried to do a counter so when a connection is made it increments and then if counter>=numOfClients
set a variable to true or false and this is sent with the server setup so it determines if the server code is run or it just closes the connection but there is no way I can access the counter variable from within a runnable class thread when a client closes connection it should -1 from the variable
thanks -
How to retrieve a Connection Pool name form a DataSource
I couldn't find a way of retrieving JDBC Connection Pool name (or JDBCConnectionPoolRuntimeMBean
object) from a DataSource object.
I use the standard approach to get a Datasource:
Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, sJndiUrl);
ctx = new InitialContext(ht);
dataSource = (javax.sql.DataSource) ctx.lookup (s);
It works fine !
I know that each datasource is mapped to a connection pool & need to retrieve
either connection pool's name or JDBCConnectionPoolRuntimeMBean object from the
datasource, but didn't find any function that would allow me to do that."Oleg Gryb" <[email protected]> wrote:
>
I couldn't find a way of retrieving JDBC Connection Pool name (or JDBCConnectionPoolRuntimeMBean
object) from a DataSource object.
I've just found a solution for that, but didn't like it too much because it uses
undocumented class & function. Probably BEA should include the documentation for
weblogic.jdbc.common.internal.RmiDataSource or provide an alternative way of getting
JDBCConnectionPoolRuntimeMBean object from a datasource. The solution is below:
RmiDataSource dataSource = (RmiDataSource) ctx.lookup (s);
Properties propDs = dataSource.getDriverProperties();
String sPoolName = propDs.getProperty("connectionPoolID");
MBeanHome mbeanAdmin = (MBeanHome)ctx.lookup(MBeanHome.LOCAL_JNDI_NAME);
JDBCConnectionPoolRuntimeMBean jdbcPool = (JDBCConnectionPoolRuntimeMBean)
mbeanAdmin.getRuntimeMBean(sPool,"JDBCConnectionPoolRuntime");
Now I have JDBCConnectionPoolRuntimeMBean object that I can use to access different
kind of pool's counts, e.g. number of current connections, number of leaked connections,
etc. I need this information to monitor pool programmatically & send alerts to
a suport team if e.g. number of active connections reaches a certain threshold.
If there is a better way of doing this please let me know.
Please also notice that I don't want an application to know anything about the
Connection Pool being used, an application should know only about a datasource.
Thanks.
Maybe you are looking for
-
How do i get two ipods on one computer
Ok How can I share songs with two ipods on one computer!!! Help PLEASE !!!!!!!!!1
-
How to hide messagetextinput item on root node in HGRID
Hi, I have added one messagetextinput item in HGRID. But it is showing 3 items(one for root node, 2 for the actual items) when there are 2 rows in master node. +Employee |________| -101 |________| -102 |________| I want to hide the item at r
-
Why can't I see any notification when message come from Tweeter or Facebook?
After installed OSX 10.8 GM and Facebook developer perview. I double check my setting, suppose it can receive anything form Facebook and Tweeter. But the result is, nothing show in the notification center. At the sametime, new mail can show up! Do I
-
Finder Windows always open new windows when clicking subfolders
since i upgraded to 10.5.6, my finder windows only open new windows when I click on a subfolder. this is no matter what I do with the setting in preferences. Also, my finder windows no longer display the side bars with folder icons. I searched my lib
-
Strange strace output & Abiword crash
I asked a similar question before, without getting any answers, so I try again: When I run strace <some command>, the output starts with a lot of lines saying that this-and-that file belonging to programs I no longer have installed cannot be found. O