Lots of TIME_WAITs with Connection Pool and Oracle
Hi,
I've set up a simple servlet to hit a database and have been running
some stress tests against it. Even if I limit the connection pool size
to a fixed number of connections, when I run netstat I get lots of
additional connections to the database machine showing up in the
TIME_WAIT state. The original connections from the pool are still there
as ESTABLISHED. Can anyone tell me where all the other ones are coming
from. I've tried using both oracle thin and oci8 drivers but I still
get the same problems.
Cheers,
Luke.
Luke Taylor.
PGP Key ID: 0x57E9523C
check out
1. the code is releasing the connections it got?
2. are there any database connections from outside the weblogic pool.
Luke Taylor <[email protected]> wrote:
Hi,
I've set up a simple servlet to hit a database and have been running
some stress tests against it. Even if I limit the connection pool size
to a fixed number of connections, when I run netstat I get lots of
additional connections to the database machine showing up in the
TIME_WAIT state. The original connections from the pool are still there
as ESTABLISHED. Can anyone tell me where all the other ones are coming
from. I've tried using both oracle thin and oci8 drivers but I still
get the same problems.
Cheers,
Luke.
Luke Taylor.
PGP Key ID: 0x57E9523C
Similar Messages
-
JDBC 8.1.6 Connection Pooling and Oracle Objects
I managed to make OracleConnectionCacheImpl class work and I noticed one very strange thing:
when I use simple SQL, connection cache works as good as single permanently opened connection but when I return Oracle objects with nested datasets in my result set performance degrades 10 times to compare to the same sql in case I am using single permanently opened connection.
I am using custom classess generated by JPublisher to access the objects
Example:
Single permanently opened connection
Simple SQL - 0.1 sec
Objects with nested datasets - 0.5 sec
Pooled connection
Simple SQL - 0.15 sec
Objects with nested datasets - 5 sec<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jason zheng ([email protected]):
OracleConnectionCacheImpl occ = new OracleConnectionCacheImpl();
occ.setURL("jdbc:oracle:thin:@xx.xx.xx.xx:1521:xxxx);
occ.setUser("xx");
occ.setPassword("xxx");
//optional
occ.setMaxLimit(3);
occ.setMinLimit(1);
.....//check api doc
//retrieve connection
Connection conn = occ.getConnection();
//close logical connection
conn.close()
//close phsical connection
occ.close();<HR></BLOCKQUOTE>
That's all fine and dandy until you try to use JNDI with it. If you create the instance and setMinLimit() when a client tries to get a connection from a JNDI lookup it throws an error saying something like: " user credentials don't match"
null -
and I've tried several ways and does not connect, I vote errors like this
Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in C:\xampp\htdocs\conexion oracle\consulta.php on line 4
array(4) { ["code"]=> int(12154) ["message"]=> string(65) "ORA-12154: TNS:could not resolve the connect identifier specified" ["offset"]=> int(0) ["sqltext"]=> string(0) "" } Conexion es invalida
almost always all errors have to do with the oci8 funsiones
I appreciate the help you could provideORA-12154 ALWAYS only occurs on SQL Client & no SQL*Net packets ever leave client system
ORA-12154 NEVER involves the listener, the database itself or anything on the DB Server.
ORA-12154 occurs when client requests a connection to some DB server system using some connection string.
TNS-03505 is thrown by tnsping & is same error as ORA-12154 thrown by sqlplus or others.
The lookup operation fails because the name provided can NOT be resolved to any remote DB.
The analogous operation would be when you wanted to call somebody, but could not find their name in any phonebook.
The most frequent cause for the ORA-12154 error is when the connection alias can not be found in tnsnames.ora.
The lookup operation of the alias can be impacted by the contents of the sqlnet.ora file; specifically DOMAIN entry.
So post the content of the sqlnet.ora file.
TROUBLESHOOTING GUIDE: ORA-12154 & TNS-12154 TNS:could not resolve service name [ID 114085.1]
http://edstevensdba.wordpress.com/2011/02/26/ora-12154tns-03505/ -
ODI 11.1.1.7.0 connect to DB with connection pool
Hello!
ODI standalone agent 11.1.1.7.0 now make a connect to DB with connection pool and set "client identifier" in the session.
How to disable connection pooling?
Thank youSolved by downloading and installing
Version 11.1.0.7.0
Instant Client Package - Basic: All files required to run OCI, OCCI, and JDBC-OCI applications
from http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html. -
Is connection pooling and sharing available on Oracle 9i RDBMS ?
Hello,
I would like to connect from oracle to sql server through db link and ODBC (Heterogenous connectivity). But every session in oracle launch session in sql server. Is it possible to have connection pooling and sharing from Oracle RDBMS level ? I need one solution : when (for example) i run 100 sessions in Oracle i would like to see 10 sessions on sql server. I would like remain 90 sessions from oracle to be queued.
I would mention that i was using Heterogenous connectivity with multithreading agent (agtctl) without success.
appreciate any help :-)There are two concepts you could evaluate, but they are mainly used for connections to the database, not to sqlserver, but if you can make them work with heterogeneous connectivity this could help:
Connection Pooling. When many sessions are connecting to the same database, it could be that some of them remain idle. Oracle can detect them and timed them out letting another session to enter into the database, letting the idle session remain open without closing its session. This is configured by means of the shared server architecture.
Session Multiplexing. Session multiplexing allows the same bandwidth to be used by many sessions at the same time, this enables the server to use fewer network connection endpoints for incoming request. In order for you to configure session multiplexing you have to configure connection manager.
Ref. Oracle® Database Net Services Administrator's Guide
10g Release 2 (10.2)
Part Number B14212-02
~ Madrid
http://hrivera99.blogspot.com/ -
Connection pooling and auditing on an oracle database
Integration of a weblogic application with an oracle backend,
Connection pooling, and auditing ,2 conflicting requirements ?
Problem statement :
We are in the process of maintaining a legacy client server application where
the client is
written in PowerBuilder and the backend is using an Oracle database.
Almost all business logic is implemented in stored procedures on the database.
When working in client/server mode ,1 PowerBuilder User has a one-to-one relation
with
a connection(session) on the oracle database.
It is a requirement that the database administrator must see the real user connected
to the database
and NOT some kind of superuser, therefore in the PowerBuilder app each user connects
to the database
with his own username.(Each user is configured on the database via a seperate
powerbuilder security app).
For the PowerBuilder app all is fine and this app can maintain conversional state(setting
and
reading of global variables in oracle packages).
The management is pushing for web-based application where we will be using bea
weblogic appserver(J2EE based).
We have build an business app which is web-based and accessing the same oracle
backend app as
the PowerBuilder app is doing.
The first version of this web-based app is using a custom build connector(based
on JCA standard and
derived from a template provided by the weblogic integration installation).
This custom build connector is essentially a combination of a custom realm in
weblogic terms
and a degraded connection pool , where each web session(browser) has a one-to-one
relation
with the back end database.
The reason that this custom connector is combining the security functionality
and the pooling
functionality , is because each user must be authenticated against the oracle
database(security requirement)
and NOT against a LDAP server, and we are using a statefull backend(oracle packages)
which would make it
difficult to reuse connections.
A problem that surfaced while doing heavy loadtesting with the custom connector,
is that sometimes connections are closed and new ones made in the midst of a transaction.
If you imagine a scenario where a session bean creates a business entity ,and
the session bean
calls 1 entity bean for the header and 1 entity bean for the detail, then the
header and detail
must be created in the same transaction AND with the same connection(there is
a parent-child relationship
between header and detail enforced on the back end database via Primary and Foreing
Keys).
We have not yet found why weblogic is closing the connection!
A second problem that we are experincing with the custom connector, is the use
of CMP(container managed persistence)
within entity beans.
The J2EE developers state that the use of CMP decreases the develoment time and
thus also maintenance costs.
We have not yet found a way to integrate a custom connector with the CMP persistence
scheme !
In order to solve our loadtesting and CMP persistence problems i was asked to
come up with a solution
which should not use a custom connector,but use standard connection pools from
weblogic.
To resolve the authentication problem on weblogic i could make a custom realm
which connects to the
backend database with the username and password, and if the connection is ok ,
i could consider this
user as authenticated in weblogic.
That still leaves me with the problem of auditing and pooling.
If i were to use a standard connection pool,then all transaction made in the oracle
database
would be done by a pool user or super user, a solution which will be rejected
by our local security officer,
because you can not see which real user made a transaction in the database.
I could still use the connection pool and in the application , advise the application
developers
to set an oracle package variable with the real user, then on arrival of the request
in the database,
the logic could use this package variable to set the transaction user.
There are still problems with this approach :
- The administrator of the database can still not see who is connected , he will
only see the superuser connection.
- This scheme can not be used when you want to use CMP persistence , since it
is weblogic who will generate the code
to access the database.
I thought i had a solution when oracle provided us with a connection pool known
as OracleOCIConnectionPool
where there is a connection made by a superuser, but where sessions are multiplexed
over this physical pipe with the real user.
I can not seem to properly integrate this OCI connectionpool into weblogic.
When using this pool , and we are coming into a bean (session or entity bean)
weblogic is wrapping
this pool with it's own internal Datasource and giving me back a connection of
the superuser, but not one for the real user,
thus setting me with my back to the wall again.
I would appreciate if anyone had experienced the same problem to share a possible
solution with us
in order to satisfy all requirements(security,auditing,CMP).
Many Thanks
Blyau Gino
[email protected]Hi Blyau,
As Joe has already provided some technical advice,
I'll try to say something on engineering process level.
While migrating an application from one technology to
other, like client-server to n-tier in you case, customers and
stakeholders want to push into the new system as many old
requirements as possible. This approach is AKA "we must
have ALL of the features of the old system". Mostly it happens
because they don't know what they want. Ad little understanding
of abilities of the new technology, and you will get a requirement
like the one you have in you hands.
I think "DBA must see real user" is one of those. For this
type of requirements it can make sense to try to drop it,
or to understand its nature and suggest alternatives. In this
particular case it can be a system that logs user names,
login and logout times.
Blind copying of old features into an incompatible new architecture
may endanger the whole project and can result in its failure.
Hope this helps.
Regards,
Slava Imeshev
"Blyau Gino" <[email protected]> wrote in message
news:[email protected]...
>
Integration of a weblogic application with an oracle backend,
Connection pooling, and auditing ,2 conflicting requirements ?
Problem statement :
We are in the process of maintaining a legacy client server applicationwhere
the client is
written in PowerBuilder and the backend is using an Oracle database.
Almost all business logic is implemented in stored procedures on thedatabase.
When working in client/server mode ,1 PowerBuilder User has a one-to-onerelation
with
a connection(session) on the oracle database.
It is a requirement that the database administrator must see the real userconnected
to the database
and NOT some kind of superuser, therefore in the PowerBuilder app eachuser connects
to the database
with his own username.(Each user is configured on the database via aseperate
powerbuilder security app).
For the PowerBuilder app all is fine and this app can maintainconversional state(setting
and
reading of global variables in oracle packages).
The management is pushing for web-based application where we will be usingbea
weblogic appserver(J2EE based).
We have build an business app which is web-based and accessing the sameoracle
backend app as
the PowerBuilder app is doing.
The first version of this web-based app is using a custom buildconnector(based
on JCA standard and
derived from a template provided by the weblogic integrationinstallation).
This custom build connector is essentially a combination of a custom realmin
weblogic terms
and a degraded connection pool , where each web session(browser) has aone-to-one
relation
with the back end database.
The reason that this custom connector is combining the securityfunctionality
and the pooling
functionality , is because each user must be authenticated against theoracle
database(security requirement)
and NOT against a LDAP server, and we are using a statefull backend(oraclepackages)
which would make it
difficult to reuse connections.
A problem that surfaced while doing heavy loadtesting with the customconnector,
>
is that sometimes connections are closed and new ones made in the midst ofa transaction.
If you imagine a scenario where a session bean creates a business entity,and
the session bean
calls 1 entity bean for the header and 1 entity bean for the detail, thenthe
header and detail
must be created in the same transaction AND with the same connection(thereis
a parent-child relationship
between header and detail enforced on the back end database via Primaryand Foreing
Keys).
We have not yet found why weblogic is closing the connection!
A second problem that we are experincing with the custom connector, is theuse
of CMP(container managed persistence)
within entity beans.
The J2EE developers state that the use of CMP decreases the develomenttime and
thus also maintenance costs.
We have not yet found a way to integrate a custom connector with the CMPpersistence
scheme !
In order to solve our loadtesting and CMP persistence problems i was askedto
come up with a solution
which should not use a custom connector,but use standard connection poolsfrom
weblogic.
To resolve the authentication problem on weblogic i could make a customrealm
which connects to the
backend database with the username and password, and if the connection isok ,
i could consider this
user as authenticated in weblogic.
That still leaves me with the problem of auditing and pooling.
If i were to use a standard connection pool,then all transaction made inthe oracle
database
would be done by a pool user or super user, a solution which will berejected
by our local security officer,
because you can not see which real user made a transaction in thedatabase.
I could still use the connection pool and in the application , advise theapplication
developers
to set an oracle package variable with the real user, then on arrival ofthe request
in the database,
the logic could use this package variable to set the transaction user.
There are still problems with this approach :
- The administrator of the database can still not see who is connected ,he will
only see the superuser connection.
- This scheme can not be used when you want to use CMP persistence , sinceit
is weblogic who will generate the code
to access the database.
I thought i had a solution when oracle provided us with a connection poolknown
as OracleOCIConnectionPool
where there is a connection made by a superuser, but where sessions aremultiplexed
over this physical pipe with the real user.
I can not seem to properly integrate this OCI connectionpool intoweblogic.
When using this pool , and we are coming into a bean (session or entitybean)
weblogic is wrapping
this pool with it's own internal Datasource and giving me back aconnection of
the superuser, but not one for the real user,
thus setting me with my back to the wall again.
I would appreciate if anyone had experienced the same problem to share apossible
solution with us
in order to satisfy all requirements(security,auditing,CMP).
Many Thanks
Blyau Gino
[email protected] -
Problem with creating Connection pool and JNDI, driver is not detected
Hi,
I have an issue with creating Connection Pool and JNDI.
I'm using:
- JDK 1.6
- OS: Linux(ubuntu 8.10)
- Netbeans IDE 6.5.1
- Java EE 5.0
- Apache Tomcat 6.0.18 Its lib directory contains all necessary jar files for Oracle database driver
- Oracle 11g Enterprise
My problem is that the Oracle database driver is not detected when I want to create a pool (it works pretty well and is detected without any problem when I create ordinary connection by DriverManager)
Therefore after running:
InitialContext ic = new InitialContext();
Context context = (Context)ic.lookup("java:comp/env");
DataSource dataSource = (DataSource)context.lookup("jdbc/oracle11g");
Connection connection = dataSource.getConnection();and right after dataSource.getConnection() I have the following exception:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.OracleDriver'
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at servlets.Servlet1.doPost(Servlet1.java:47)
at servlets.Servlet1.doGet(Servlet1.java:29)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1130)
... 17 more
My application context file (context.xml) is:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/WebApplication3">
<Resource auth="Container"
driverClassName="oracle.jdbc.OracleDriver"
maxActive="8"
maxIdle="4"
name="jdbc/oracle11g"
username="scott"
password="tiger"
type="javax.sql.DataSource"
url="jdbc:oracle:thin:@localhost:1521:database01" />
</Context>and my web.xml is:
<resource-ref>
<description>Oracle Datasource example</description>
<res-ref-name>jdbc/oracle11g</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
...I found similar threads in different forums including sun, such as
http://forums.sun.com/thread.jspa?threadID=567630&start=0&tstart=0
http://forums.sun.com/thread.jspa?threadID=639243&tstart=0
http://forums.sun.com/thread.jspa?threadID=5312178&tstart=0
, but no solution.
As many suggest, I also tried to put context directly in the server.xml (instead of my application context) and referencing it by <ResourceLink /> inside my application context but it didn't work and instead it gave me the following message:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class ' ' for connect URL 'null'
Has anyone succeeded in creating a connection pool with JNDI by using Tomcat 6 or higher ? If yes, could kindly explain about the applied method.
Regards,Hello again,
Finally I managed to run my application also with Tomcat 6.0.18. There was only two lines that had to be modified
in the context.xml file (the context of my application project and not server's)
Instead of writing
<Context antiJARLocking="true" path="/WebApplication2">
type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
</Context>we had to write:
<Context antiJARLocking="true" path="/WebApplication2">
type="oracle.jdbc.pool.OracleDataSource"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
</Context>- No modification was needed to be done at server level (niether server.xml nor server context.xml)
- I just added the ojdbc6.jar in $CATALINA_HOME/lib (I didn't even need to add it in WEB-INF/lib of my project)
- The servlet used to do the test was the same that I presented in my precedent post.
For those who have encountered my problem and are interested in the format of the web.xml and context.xml
with Tomcat 6.0, you can find them below:
Oracle server: Oracle 11g Enterprise
Tomcat server version: 6.0.18
Oracle driver: ojdbc.jar
IDE: Netbeans 6.5.1
The context.xml file of the web application
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/WebApplication2">
<Resource name="jdbc/oracle11g"
type="oracle.jdbc.pool.OracleDataSource"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
url="jdbc:oracle:thin:@localhost:1521:database01"
driverClassName="oracle.jdbc.OracleDriver"
userName="scott"
password="tiger"
auth="Container"
maxActive="100"
maxIdle="30"
maxWait="10000"
logAbandoned="true"
removeAbandoned="true"
removeAbandonedTimeout="60" />
</Context>The web.xml of my web application
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<resource-ref>
<description>Oracle Database 11g DataSource</description>
<res-type>oracle.jdbc.pool.OracleDataSource</res-type>
<res-auth>Container</res-auth>
<res-ref-name>jdbc/oracle11g</res-ref-name>
</resource-ref>
<servlet>
<servlet-name>Servlet1</servlet-name>
<servlet-class>servlets.Servlet1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Servlet1</servlet-name>
<url-pattern>/Servlet1</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>Ok, now I'm happy as the original problem is completely solved
Regards -
Using oracle's connection pools and transactional context
Hi!
I have an implementations of existing interfaces ( let's call this layer as
data access layer) which abstracts the connection and transactional session
from the calling application. This implementaion makes use of Oracles JVM
inside the oracle database (8.1.7) to create and maintain the connection
pools and the transactional session (transactional context). I would like
to create differenent implementation, if the calling application is a
session bean running inside the weblogic application server. is there way I
can still use the connection pools and transactinal context that I got from
the oralce if the calling application is a session bean running inside the
weblogic app.. server?
do I have to change any configuration settings in weblogic?. there might
be two scenarios..
the data access layer (the classes which deal with the connection pools and
transactions) might be running inside the oracle's JVM..
the data access layer might be running inside weblogic application server...
thanks...
SrinivasCertainly this from SPAM. Now from anothe user :). Note sure whether I should mark you as you as SPAM as you're posting questions which are available in stackoverflow
http://stackoverflow.com/questions/26531161/biztalk-and-odp-net-connection-pools-and-connection-strings
Details provided in the other forum should provide you the answer.
I don’t want to duplicate this thread just for the sake of giving reply.
If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply. -
Oracle Application server connection pool and database links
I am using Oracle application server 10g with connection pools, the db used by the application connects to another oracle db using a database link. My question is when the application starts it creates 10 connections, does it also create x amount of database links as well?
Hi,
Is there any way to use the connection pool or Datasource while connecting to database?If I am using a stateless sesssion bean and using a Data Access layer which just creates a database session to write the persistence toplink objects how I can make use of application server connection pool?Hi Vinod,
Yes, TopLink allows you to use the app server's connection pooling and transaction services. Chapter 2 of the Oracle9iAS TopLink Foundation Library Guide provides details as do the TopLink examples. The easiest way to set this up is by using the sessions.xml file. The sample XML below is from the file <toplink903>\examples\ias\examples\ejb\sessionbean\sessions.xml. Here we are adding the datasource defined in OC4J and specifying that we are using the OC4J transaction controller also.
<login>
<user-name>sa</user-name>
<password></password>
<datasource>java:comp/env/jdbc/ejbJTSDataSource</datasource>
<uses-external-transaction-controller>true</uses-external-transaction-controller>
<uses-external-connection-pool>true</uses-external-connection-pool>
</login>
<external-transaction-controller-class>oracle.toplink.jts.oracle9i.Oracle9iJTSExternalTransactionController</external-transaction-controller-class>
When using this approach you need to change your TopLink code slightly in the EJB methods:
a. Acquire the ACTIVE unit of work from the server
session (again, see the EmployeeSessionEJB code
example) with something like:
UnitOfWork uow = clientSession.getActiveUnitOfWork();
b. Calls to uow.commit() can be ommitted or commented out
because the EJB will handle this. Note that of course
the methods you create in the EJB that are using this
approach must have TX Required (default).
Hope this helps.
Pete -
What is the usual way of accessing Oracle by JSF with connection pooling?
I am writing to access Oracle by JSF with connection pooling.
EJB is too difficult for me.
What is the simple way of doing it?
thanksLeung,
I believe there should be some sample code available via the JavaServer Pages Samples Web page.
Good Luck,
Avi. -
Connection Pool and Database Sessions
Hi,
Is there any way to use the connection pool or Datasource while connecting to database?If I am using a stateless sesssion bean and using a Data Access layer which just creates a database session to write the persistence toplink objects how I can make use of application server connection pool?
Thanks,
VinodHi,
Is there any way to use the connection pool or Datasource while connecting to database?If I am using a stateless sesssion bean and using a Data Access layer which just creates a database session to write the persistence toplink objects how I can make use of application server connection pool?Hi Vinod,
Yes, TopLink allows you to use the app server's connection pooling and transaction services. Chapter 2 of the Oracle9iAS TopLink Foundation Library Guide provides details as do the TopLink examples. The easiest way to set this up is by using the sessions.xml file. The sample XML below is from the file <toplink903>\examples\ias\examples\ejb\sessionbean\sessions.xml. Here we are adding the datasource defined in OC4J and specifying that we are using the OC4J transaction controller also.
<login>
<user-name>sa</user-name>
<password></password>
<datasource>java:comp/env/jdbc/ejbJTSDataSource</datasource>
<uses-external-transaction-controller>true</uses-external-transaction-controller>
<uses-external-connection-pool>true</uses-external-connection-pool>
</login>
<external-transaction-controller-class>oracle.toplink.jts.oracle9i.Oracle9iJTSExternalTransactionController</external-transaction-controller-class>
When using this approach you need to change your TopLink code slightly in the EJB methods:
a. Acquire the ACTIVE unit of work from the server
session (again, see the EmployeeSessionEJB code
example) with something like:
UnitOfWork uow = clientSession.getActiveUnitOfWork();
b. Calls to uow.commit() can be ommitted or commented out
because the EJB will handle this. Note that of course
the methods you create in the EJB that are using this
approach must have TX Required (default).
Hope this helps.
Pete -
How dynamically create connection pool and Datasource
Hi
How I can dynamically create a connection pool and Data source in Oracle 10g Application server. In our J2EE application the user will be login with db user name, password and database name. I want to create connection pool and data source on the fly while login the user with database name. I our application we have access approximate 80 Databases. so my approach is given bellow
1) Planning to create 80 connection pools and 80 Data sources so when user logs in while selecting the db name i will call the appropriate data source and create the DB connection. Is there any limitation to create number of data sources in oracle app server?
2) Create DB connection with out using connection pool and data source. But i am not prefer this approach coz we need to handle some transaction in our application.
Kindly throw some light on managing connection pool programmatically or in application run time.
I would really appreciate if any one can provide any links or any inormation on this issue.
Thanks in advance.Kindly let me know is there any drawbacks to create 80 Data Sources to connect 80 database in Oracle 10G App server and each data sources should have one connection pool. so i need to create 80 connection pool. Please let me know is this right approach or any work around to create Data source on fly for each request for corresponding database.
-
Listener EA2: database connection pool and connection revalidation
Hi all,
As one can expect from early adopter release there could be some bugs but I can't find any references in forum to my situation:
* My 11g XE database and listener are starting as windows services when server boots operating system (Windows Server 2003 R2).
* I configured my web server (unsupported Jetty 9.0.0.M1) to start as windows service when operating system starts.
* Apex Listener 2.0.0.268.17.05 configured to connect with XE using JDBC thin driver with default settings (initial pool size 3, max statements 10, min connections 1, max connections 10, inactivity timeout 1800, abandoned connection timeout 900)
* Because web server starts a bit faster than Oracle database when apex connects first time it gets "ORA-12528, TNS:listener: all appropriate instances are blocking new connections" (could be that database still starting but already registered service with listener)
* From listener.log file I can see that all further connections made from Apex listener succeeds
* When I try to open any apex page with browser I am getting 404 error and apex listener logs error (*time is 2 days after system startup*):
2012-11-30 3:56:02 PM oracle.dbtools.common.config.db.DatabaseConfig badConfiguration
SEVERE: The pool named: apex is not correctly configured, error: Listener refused the connection with the following error:
ORA-12528, TNS:listener: all appropriate instances are blocking new connections
ConnectionPoolException [error=BAD_CONFIGURATION]
at oracle.dbtools.common.jdbc.ConnectionPoolException.badConfiguration(ConnectionPoolException.java:62)
at oracle.dbtools.common.config.db.DatabaseConfig.badConfiguration(DatabaseConfig.java:146)
at oracle.dbtools.common.config.db.DatabaseConfig.createPool(DatabaseConfig.java:168)
at oracle.dbtools.common.config.db.DatabaseConfig.getConnection(DatabaseConfig.java:68)
at oracle.dbtools.common.jdbc.ora.OraPrincipal.connection(OraPrincipal.java:25)
at oracle.dbtools.apex.ModApexContext.getConnection(ModApexContext.java:320)
at oracle.dbtools.apex.Procedure.getProcedure(Procedure.java:166)
at oracle.dbtools.apex.OWA.validateProcedure(OWA.java:384)
at oracle.dbtools.apex.security.Security.isValidRequest(Security.java:171)
at oracle.dbtools.apex.ModApex.validateRequest(ModApex.java:233)
at oracle.dbtools.apex.ModApex.doGet(ModApex.java:79)
at oracle.dbtools.apex.ModApex.service(ModApex.java:263)
at oracle.dbtools.rt.web.HttpEndpointBase.modApex(HttpEndpointBase.java:288)
at oracle.dbtools.rt.web.HttpEndpointBase.service(HttpEndpointBase.java:127)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:665)
<... Jetty web server stack ...>
at java.lang.Thread.run(Unknown Source)
2012-11-30 3:56:02 PM oracle.dbtools.rt.web.HttpEndpointBase modApex
* Oracle listener log for same time (no errors here):
30-NOV-2012 15:56:01 * (CONNECT_DATA=(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))(SERVICE_NAME=xe)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1078)) * establish * xe * 0
30-NOV-2012 15:56:01 * (CONNECT_DATA=(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))(SERVICE_NAME=xe)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1079)) * establish * xe * 0
30-NOV-2012 15:56:01 * (CONNECT_DATA=(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))(SERVICE_NAME=xe)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1080)) * establish * xe * 0
30-NOV-2012 15:56:01 * (CONNECT_DATA=(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))(SERVICE_NAME=xe)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1081)) * establish * xe * 0
* For some reason apex listener keeps first connection status and won't try to establish new connection if first attempt finished with ORA-12528
* The same scenario is valid when at time of web server start oracle database/listener is not available - even if database and listener starts and apex successfully establishes further connections all apex pages gets 404 error
* If I restart web server windows service (while oracle db and listener still running) browser opens apex pages without errors and apex listener does not log any errors
* I know that I can avoid this error delaying start of web server windows service but it would be nice to have production release 2.x without such bugsHi,
Is there any way to use the connection pool or Datasource while connecting to database?If I am using a stateless sesssion bean and using a Data Access layer which just creates a database session to write the persistence toplink objects how I can make use of application server connection pool?Hi Vinod,
Yes, TopLink allows you to use the app server's connection pooling and transaction services. Chapter 2 of the Oracle9iAS TopLink Foundation Library Guide provides details as do the TopLink examples. The easiest way to set this up is by using the sessions.xml file. The sample XML below is from the file <toplink903>\examples\ias\examples\ejb\sessionbean\sessions.xml. Here we are adding the datasource defined in OC4J and specifying that we are using the OC4J transaction controller also.
<login>
<user-name>sa</user-name>
<password></password>
<datasource>java:comp/env/jdbc/ejbJTSDataSource</datasource>
<uses-external-transaction-controller>true</uses-external-transaction-controller>
<uses-external-connection-pool>true</uses-external-connection-pool>
</login>
<external-transaction-controller-class>oracle.toplink.jts.oracle9i.Oracle9iJTSExternalTransactionController</external-transaction-controller-class>
When using this approach you need to change your TopLink code slightly in the EJB methods:
a. Acquire the ACTIVE unit of work from the server
session (again, see the EmployeeSessionEJB code
example) with something like:
UnitOfWork uow = clientSession.getActiveUnitOfWork();
b. Calls to uow.commit() can be ommitted or commented out
because the EJB will handle this. Note that of course
the methods you create in the EJB that are using this
approach must have TX Required (default).
Hope this helps.
Pete -
Need ACES attention - connection pooling in oracle 10g rel 1
I am using TOMCAT 5.0.19 Webserver and ORACLE 10g REL 1 as the database server. I have to restart the TOMCAT Webserver in order to establish connection atleast twice or thrice in a weak. Why I am unable to see the connection pooling in oracle 10g rel 1. How to revive or establish the setup. My objective is to have a centralised oracle 10g rel 1 database server and the applications of java are run thru centralised Webserver Tomcat 5.0.19.
Can anyone please help me out optimizing the design setup.
Regards
Vijay Kumarby putting 'Need ACES' in your post title, you might have actually reduced the number of people reading your post, in other words someone >who might have suggested Thanks John for your reply. I changed the subject of the thread after not getting any reply for past 10 days. Last two days I have been updating with plea for attention to my problem. Finally I thought pulling attention of ACES, then only I edited the subject.
Now, problem I am facing is not in oracle database but in application server. Actually we are running web applications thru Tomcat accessing Oracle 10g rel 1. I am often losing connection with web server. The users are unable to login in the web application. I was told to check oracle database server. I just checked alert log and found no errors. I just asked them to shutdown and restart the web server Tomcat 5.0. It then worked fine. This is temporary. I need to ensure where the problem is. Could you please guide me in checking various parameters or files to be checked to optimise connection pooling.
Regards
Vijay Kumar -
Can I create connection pool by oracle oci driver?
Can I create connection pool by oracle oci driver?My weblogic's version is 6.1 sp2 and oracle is 9.0.1.2.
I have some trouble with connection pool created by weblogic jDriver.
I try to read Timestamp from table and I always get the exception.It told me that ORA-00932: inconsistent datatypes.
So I created another pool by oracle thin driver and everything was right.Then I created other pool by oracle oci driver,but something were wrong. 'Could not create pool connection. The DBMS driver exception was:java.sql.SQLException: ORA-06401: NETCMN:Invalid driver designator'
The oci pool's parameters are below lines.
url: jdbc:oracle:oci:@COCO
Driver Classname: oracle.jdbc.driver.OracleDriver
Properties: user=scott;password=tiger;protocol=oci
If I get connection directly,don't use connection pool,I can get right connection.But why didn't I create pool by oci driver?Maybe weblogic7 or weblogic8 will work good?Venkat Amirineni wrote:
Hi Joe,
I am also trying to create a connection pool using Oracle Oci XA. Weblogic
type 2 oci threads hanging on native calls and suggested to go for thin drivers.
But we want to try with Oracle Oci drivers.. Can you please tell us how to
create a conn pool using Oracle Oci.. Just the driverclass and url is enough
or need any classpath settings etc..
Thanks in advance for your quick reply.Hi. As far as driver properties, just use what Oracle says to. Any pool properties
that we recommend for XA would still apply. Note that Oracle themselves recommends
the thin driver over their OCI one:
http://download-west.oracle.com/docs/cd/B14117_01/java.101/b10979.pdf
Joe
Maybe you are looking for
-
How to insert multiple line items in fv60 using bdc.
Hi all, How to insert multiple line items in fv60 using bdcs
-
Wget returns a 403 forbidden message but IE/Mozilla continues to run jsp
Hi, I have just seen a section of code from a jsp file that looks like this: response.setStatus( response.SC_FORBIDDEN,"getlogout.inc" ); %><%@include file="getlogin0.inc" %><%Basically this is used as part of a security check - if the user has not a
-
Hi: I've seen in some web sites that when you hover the mouse over an image a little popup Text Window without any borders/toolbar is displayed with some text to convey a message. Once you hover of the image, the popup window disappears. My question
-
Lync doesnot use microphone for audio calls in Mac
Hi, When Im calling from my Lync the person on the other side cannot hear my voice. Im using lync on my mac. This used to work before but has suddenly stopped working. My lync version is 14.0.10 and my OSX is 10.9.5. I use skype for audio calls on th
-
Keyboard not responsive unless in terminal
Hi, my keyboard only seems to work in terminal but when I start kde or openbox it does work. I`d appreciate if someone could point me in the right direction.