You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Anjib Mulepati <an...@hotmail.com> on 2012/01/03 18:08:40 UTC

DB Connection error

Hi All,

One simple question If I have JINDI configuration in my application will 
my application reconnect to the DB whenever my DB gets restart.
I am having DB connection problem every Monday since our DB get 
restarted on weekends which we don't have control of.
I am using Tomcat 6.0.20

Thanks
Anjib

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: DB Connection error

Posted by Ron McNulty <rm...@clear.net.nz>.
Hi Anjib

Port 8080 looks very odd. For an Oracle XE database, this is an HTTP 
connection to the database admin console, but you need a TNS connection 
direct to the database.

Try "telnet localhost 1521" from the command line. If this connects, you 
probably have a standard Oracle database on its default port.

I would expect something like url="jdbc:oracle:thin:@localhost:1521/XE" to 
connect to a local XE installation (the only supported schema name is XE). 
This works fine on my local installation. Else 
url="jdbc:oracle:thin:@localhost:1521/MYDBS" if you have a full local Oracle 
installation and MYDBS is the schema name. Note that the double slashes have 
gone in the URL.

You will also need to put a copy of ojdb6.jar in the Tomcat shared libs 
directory.

You can easily test the connection string by using a simple SQL client like 
SQuirrel SQL.

Hope that helps.

Regards

Ron



----- Original Message ----- 
From: "Anjib Mulepati" <an...@hotmail.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Wednesday, January 04, 2012 7:26 AM
Subject: Re: DB Connection error


> On 1/3/2012 1:12 PM, Chema wrote:
>> 2012/1/3 Anjib Mulepati<an...@hotmail.com>:
>>> Hi All,
>>>
>>> One simple question If I have JINDI configuration in my application will 
>>> my
>>> application reconnect to the DB whenever my DB gets restart.
>>> I am having DB connection problem every Monday since our DB get 
>>> restarted on
>>> weekends which we don't have control of.
>>> I am using Tomcat 6.0.20
>> Hi:
>>
>> can you attach your<Resource/>  element in server.xml file ( except
>> sensible data )?
>
> I haven't change anythign in server.xml so i have default in it
> <GlobalNamingResources>
> <Resource name="UserDatabase" auth="Container"
>               type="org.apache.catalina.UserDatabase"
>               description="User database that can be updated and saved"
> 
> factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>               pathname="conf/tomcat-users.xml" />
> </GlobalNamingResources>
>
> But in my application I have context.xml with following
>
> <Context antiJARLocking="true" path="/myApp">
> <Resource auth="Container"
>             driverClassName="oracle.jdbc.driver.OracleDriver"
>             maxActive="20"
>             maxIdle="10"
>             maxWait="-1"
>             name="jdbc/myName"
>             password="myPassword"
>             type="javax.sql.DataSource"
>             url="jdbc:oracle:thin:@//localhost:8080/MYDBS"
>             username="myUsername"
>              />
> </Context>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: DB Connection error

Posted by Anjib Mulepati <an...@hotmail.com>.
com.anjib.exceptions.ICDAOException: Error in your database.
     at com.anjib.actions.GetMyListAction.execute(GetMyListAction.java:71)
     at 
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
     at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
     at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
     at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
     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.valves.RequestDumperValve.invoke(RequestDumperValve.java:151)
     at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
     at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
     at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
     at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
     at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
     at java.lang.Thread.run(Thread.java:619)
Caused by: com.anjib.exceptions.ICDAOException: No more data to read 
from socket
     at com.anjib.dao.oracle.Table1DAO.getAll(Table1DAO.java:206)
     at com.anjib.actions.GetMyListAction.execute(GetMyListAction.java:65)
     ... 20 more
Caused by: java.sql.SQLRecoverableException: No more data to read from 
socket
     at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1142)
     at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1099)
     at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:288)
     at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
     at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
     at 
oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
     at 
oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:863)
     at 
oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1153)
     at 
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1275)
     at 
oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1477)
     at 
oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:392)
     at 
org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
     at com.anjib.dao.oracle.Table1DAO.getAll(Table1DAO.java:197)
     ... 21 more

On 1/9/2012 10:33 AM, Chema wrote:
> 2012/1/9 Anjib Mulepati<an...@hotmail.com>:
>> I did change my config.xml to
>>
>>
>> <Context antiJARLocking="true" path="/myApp">
>> <Resource auth="Container"
>>             driverClassName="oracle.jdbc.driver.OracleDriver"
>>             maxActive="20"
>>             maxIdle="10"
>>             maxWait="-1"
>>             name="jdbc/myName"
>>             password="myPassword"
>>             testOnBorrow="true"
>>
>>             type="javax.sql.DataSource"
>>             url="jdbc:oracle:thin:@//localhost:8080/MYDBS"
>>             username="myUsername"
>>             validationQuery="SELECT 1 FROM DUAL" />
>> </Context>
>>
> Can you attach error trace ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: DB Connection error

Posted by Chema <de...@gmail.com>.
2012/1/9 Anjib Mulepati <an...@hotmail.com>:
> I did change my config.xml to
>
>
> <Context antiJARLocking="true" path="/myApp">
> <Resource auth="Container"
>            driverClassName="oracle.jdbc.driver.OracleDriver"
>            maxActive="20"
>            maxIdle="10"
>            maxWait="-1"
>            name="jdbc/myName"
>            password="myPassword"
>            testOnBorrow="true"
>
>            type="javax.sql.DataSource"
>            url="jdbc:oracle:thin:@//localhost:8080/MYDBS"
>            username="myUsername"
>            validationQuery="SELECT 1 FROM DUAL" />
> </Context>
>

Can you attach error trace ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: DB Connection error

Posted by "Propes, Barry L " <ba...@citi.com>.
Oh ok, thanks for the clarification.


-----Original Message-----
From: Konstantin Kolinko [mailto:knst.kolinko@gmail.com] 
Sent: Monday, January 09, 2012 1:51 PM
To: Tomcat Users List
Subject: Re: DB Connection error

2012/1/9 Propes, Barry L <ba...@citi.com>:
> I think some Oracle desktop installations, like Oracle XE, come with 8080 as the out-of-the-box default port.

AFAIK 8080 was used by Oracle XE for its web-based management console.
Using it as a database URL is something new. I'd expect 1521 there.

By the way, using infinite timeout on the pool (maxWait="-1") is a bad
option. I would recommend something more realistic.

>
>
> -----Original Message-----
> From: Chema [mailto:demablogia@gmail.com]
> Sent: Monday, January 09, 2012 12:03 PM
> To: Tomcat Users List
> Subject: Re: DB Connection error
>
>> Caused by: oracle.net.ns.NetException: The Network Adapter could not
>> establish the connection
>>    at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:375)
>>    at
>> oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:422)
>>    at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:678)
>>    at oracle.net.ns.NSProtocol.connect(NSProtocol.java:238)
>>    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1054)
>>    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)
>>    ... 30 more
>> Caused by: java.net.ConnectException: Connection refused: connect
>>    at java.net.PlainSocketImpl.socketConnect(Native Method)
>>    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
>>    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
>>    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
>>    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
>>    at java.net.Socket.connect(Socket.java:529)
>>    at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:209)
>>    at oracle.net.nt.ConnOption.connect(ConnOption.java:123)
>>    at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:353)
>>    ... 35 more
>>
>
> I see that database is on the same machine than Tomcat , right ?
>
> It's important, for me at least ,  to know if this error
>
> "Caused by: java.net.ConnectException: Connection refused: connect"
>
> occurs while restarting database server or just after that ?
>
> One question : after restarting database , can you make a telnet to
> localhost:8080 from the same machine ?
> By the way, 8080 is a curious port for a database ...is it the real
> port for listening incoming connections ?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: DB Connection error

Posted by Konstantin Kolinko <kn...@gmail.com>.
2012/1/9 Propes, Barry L <ba...@citi.com>:
> I think some Oracle desktop installations, like Oracle XE, come with 8080 as the out-of-the-box default port.

AFAIK 8080 was used by Oracle XE for its web-based management console.
Using it as a database URL is something new. I'd expect 1521 there.

By the way, using infinite timeout on the pool (maxWait="-1") is a bad
option. I would recommend something more realistic.

>
>
> -----Original Message-----
> From: Chema [mailto:demablogia@gmail.com]
> Sent: Monday, January 09, 2012 12:03 PM
> To: Tomcat Users List
> Subject: Re: DB Connection error
>
>> Caused by: oracle.net.ns.NetException: The Network Adapter could not
>> establish the connection
>>    at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:375)
>>    at
>> oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:422)
>>    at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:678)
>>    at oracle.net.ns.NSProtocol.connect(NSProtocol.java:238)
>>    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1054)
>>    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)
>>    ... 30 more
>> Caused by: java.net.ConnectException: Connection refused: connect
>>    at java.net.PlainSocketImpl.socketConnect(Native Method)
>>    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
>>    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
>>    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
>>    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
>>    at java.net.Socket.connect(Socket.java:529)
>>    at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:209)
>>    at oracle.net.nt.ConnOption.connect(ConnOption.java:123)
>>    at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:353)
>>    ... 35 more
>>
>
> I see that database is on the same machine than Tomcat , right ?
>
> It's important, for me at least ,  to know if this error
>
> "Caused by: java.net.ConnectException: Connection refused: connect"
>
> occurs while restarting database server or just after that ?
>
> One question : after restarting database , can you make a telnet to
> localhost:8080 from the same machine ?
> By the way, 8080 is a curious port for a database ...is it the real
> port for listening incoming connections ?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: DB Connection error

Posted by "Propes, Barry L " <ba...@citi.com>.
I think some Oracle desktop installations, like Oracle XE, come with 8080 as the out-of-the-box default port.


-----Original Message-----
From: Chema [mailto:demablogia@gmail.com] 
Sent: Monday, January 09, 2012 12:03 PM
To: Tomcat Users List
Subject: Re: DB Connection error

> Caused by: oracle.net.ns.NetException: The Network Adapter could not
> establish the connection
>    at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:375)
>    at
> oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:422)
>    at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:678)
>    at oracle.net.ns.NSProtocol.connect(NSProtocol.java:238)
>    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1054)
>    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)
>    ... 30 more
> Caused by: java.net.ConnectException: Connection refused: connect
>    at java.net.PlainSocketImpl.socketConnect(Native Method)
>    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
>    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
>    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
>    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
>    at java.net.Socket.connect(Socket.java:529)
>    at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:209)
>    at oracle.net.nt.ConnOption.connect(ConnOption.java:123)
>    at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:353)
>    ... 35 more
>

I see that database is on the same machine than Tomcat , right ?

It's important, for me at least ,  to know if this error

"Caused by: java.net.ConnectException: Connection refused: connect"

occurs while restarting database server or just after that ?

One question : after restarting database , can you make a telnet to
localhost:8080 from the same machine ?
By the way, 8080 is a curious port for a database ...is it the real
port for listening incoming connections ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: DB Connection error

Posted by Chema <de...@gmail.com>.
> Caused by: oracle.net.ns.NetException: The Network Adapter could not
> establish the connection
>    at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:375)
>    at
> oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:422)
>    at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:678)
>    at oracle.net.ns.NSProtocol.connect(NSProtocol.java:238)
>    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1054)
>    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)
>    ... 30 more
> Caused by: java.net.ConnectException: Connection refused: connect
>    at java.net.PlainSocketImpl.socketConnect(Native Method)
>    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
>    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
>    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
>    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
>    at java.net.Socket.connect(Socket.java:529)
>    at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:209)
>    at oracle.net.nt.ConnOption.connect(ConnOption.java:123)
>    at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:353)
>    ... 35 more
>

I see that database is on the same machine than Tomcat , right ?

It's important, for me at least ,  to know if this error

"Caused by: java.net.ConnectException: Connection refused: connect"

occurs while restarting database server or just after that ?

One question : after restarting database , can you make a telnet to
localhost:8080 from the same machine ?
By the way, 8080 is a curious port for a database ...is it the real
port for listening incoming connections ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: DB Connection error

Posted by Anjib Mulepati <an...@hotmail.com>.
I have following log
com.anjib.exceptions.DAOException: Error in your database.
     at com.anjib.actions.GetMyListAction.execute(GetMyListAction.java:71)
     at 
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
     at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
     at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
     at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
     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:293)
     at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
     at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
     at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
     at java.lang.Thread.run(Thread.java:662)
Caused by: com.anjib.exceptions.DAOException: Cannot create 
PoolableConnectionFactory (IO Error: The Network Adapter could not 
establish the connection)
     at com.anjib.dao.DAOFactory.createConnection(DAOFactory.java:118)
     at com.anjib.dao.oracle.Table1DAO.getAll(Table1DAO.java:195)
     at com.anjib.actions.GetMyListAction.execute(GetMyListAction.java:65)
     ... 18 more
Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create 
PoolableConnectionFactory (IO Error: The Network Adapter could not 
establish the connection)
     at 
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)
     at 
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
     at com.anjib.dao.DAOFactory.createConnection(DAOFactory.java:116)
     ... 20 more
Caused by: java.sql.SQLRecoverableException: IO Error: The Network 
Adapter could not establish the connection
     at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:419)
     at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:536)
     at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:228)
     at 
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
     at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
     at 
org.apache.tomcat.dbcp.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
     at 
org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
     at 
org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)
     at 
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)
     ... 22 more
Caused by: oracle.net.ns.NetException: The Network Adapter could not 
establish the connection
     at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:375)
     at 
oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:422)
     at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:678)
     at oracle.net.ns.NSProtocol.connect(NSProtocol.java:238)
     at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1054)
     at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)
     ... 30 more
Caused by: java.net.ConnectException: Connection refused: connect
     at java.net.PlainSocketImpl.socketConnect(Native Method)
     at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
     at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
     at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
     at java.net.Socket.connect(Socket.java:529)
     at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:209)
     at oracle.net.nt.ConnOption.connect(ConnOption.java:123)
     at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:353)
     ... 35 more
On 1/9/2012 12:03 PM, Propes, Barry L wrote:
> Are you getting any kind of error in the logs?
>
>
> -----Original Message-----
> From: Anjib Mulepati [mailto:anjibcs@hotmail.com]
> Sent: Monday, January 09, 2012 9:22 AM
> To: Tomcat Users List
> Subject: Re: DB Connection error
>
> I did change my config.xml to
>
> <Context antiJARLocking="true" path="/myApp">
> <Resource auth="Container"
>               driverClassName="oracle.jdbc.driver.OracleDriver"
>               maxActive="20"
>               maxIdle="10"
>               maxWait="-1"
>               name="jdbc/myName"
>               password="myPassword"
>               testOnBorrow="true"
>               type="javax.sql.DataSource"
>               url="jdbc:oracle:thin:@//localhost:8080/MYDBS"
>               username="myUsername"
>               validationQuery="SELECT 1 FROM DUAL" />
> </Context>
>
> And this morning when DB restart I had to restart the tomcat to get
> connection. What can be other solutions?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: DB Connection error

Posted by "Propes, Barry L " <ba...@citi.com>.
Are you getting any kind of error in the logs?


-----Original Message-----
From: Anjib Mulepati [mailto:anjibcs@hotmail.com] 
Sent: Monday, January 09, 2012 9:22 AM
To: Tomcat Users List
Subject: Re: DB Connection error

I did change my config.xml to

<Context antiJARLocking="true" path="/myApp">
<Resource auth="Container"
             driverClassName="oracle.jdbc.driver.OracleDriver"
             maxActive="20"
             maxIdle="10"
             maxWait="-1"
             name="jdbc/myName"
             password="myPassword"
             testOnBorrow="true"
             type="javax.sql.DataSource"
             url="jdbc:oracle:thin:@//localhost:8080/MYDBS"
             username="myUsername"
             validationQuery="SELECT 1 FROM DUAL" />
</Context>

And this morning when DB restart I had to restart the tomcat to get 
connection. What can be other solutions?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: DB Connection error

Posted by Anjib Mulepati <an...@hotmail.com>.
I did change my config.xml to

<Context antiJARLocking="true" path="/myApp">
<Resource auth="Container"
             driverClassName="oracle.jdbc.driver.OracleDriver"
             maxActive="20"
             maxIdle="10"
             maxWait="-1"
             name="jdbc/myName"
             password="myPassword"
             testOnBorrow="true"
             type="javax.sql.DataSource"
             url="jdbc:oracle:thin:@//localhost:8080/MYDBS"
             username="myUsername"
             validationQuery="SELECT 1 FROM DUAL" />
</Context>

And this morning when DB restart I had to restart the tomcat to get 
connection. What can be other solutions?

On 1/3/2012 3:33 PM, Propes, Barry L wrote:
> I also have the following attributes in mine, for what it's worth.
>
>      maxIdle="30"
>      maxWait="10000"
>      maxActive="10"
>      testOnBorrow="true"
>      timeBetweenEvictionRunsMillis="-1"
>      minEvictableIdleTimeMillis="28800"
>      poolPreparedStatements="true"
>      removeAbandoned="true"
>      removeAbandonedTimeout="300"
>      logAbandoned="false"
>
> -----Original Message-----
> From: Daniel Mikusa [mailto:dmikusa@vmware.com]
> Sent: Tuesday, January 03, 2012 1:10 PM
> To: Tomcat Users List
> Subject: Re: DB Connection error
>
> On Tue, 2012-01-03 at 10:47 -0800, Chema wrote:
>>> But in my application I have context.xml with following
>>>
>>> <Context antiJARLocking="true" path="/myApp">
>>> <Resource auth="Container"
>>>             driverClassName="oracle.jdbc.driver.OracleDriver"
>>>             maxActive="20"
>>>             maxIdle="10"
>>>             maxWait="-1"
>>>             name="jdbc/myName"
>>>             password="myPassword"
>>>             type="javax.sql.DataSource"
>>>             url="jdbc:oracle:thin:@//localhost:8080/MYDBS"
>>>             username="myUsername"
>>>              />
>>> </Context>
>> Well, you can use validationQuery parameter with "SELECT 1 FROM
>> DUAL;".
> +1
>
> Try adding validationQuery="SELECT 1 FROM DUAL" and testOnBorrow="true".
>
> When you restart the DB, it's going to disconnect all of the connections
> in your pool.  If you add a validation query and one of the "testOn*"
> options (testOnBorrow is my personal favorite) then the pool will catch
> the bad connections, remove them and assuming your DB is back online,
> create new ones.
>
> Dan


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: DB Connection error

Posted by "Propes, Barry L " <ba...@citi.com>.
I also have the following attributes in mine, for what it's worth.

    maxIdle="30"
    maxWait="10000"
    maxActive="10"
    testOnBorrow="true"
    timeBetweenEvictionRunsMillis="-1"
    minEvictableIdleTimeMillis="28800"
    poolPreparedStatements="true"
    removeAbandoned="true"
    removeAbandonedTimeout="300"
    logAbandoned="false"

-----Original Message-----
From: Daniel Mikusa [mailto:dmikusa@vmware.com] 
Sent: Tuesday, January 03, 2012 1:10 PM
To: Tomcat Users List
Subject: Re: DB Connection error

On Tue, 2012-01-03 at 10:47 -0800, Chema wrote:
> > But in my application I have context.xml with following
> >
> > <Context antiJARLocking="true" path="/myApp">
> > <Resource auth="Container"
> >            driverClassName="oracle.jdbc.driver.OracleDriver"
> >            maxActive="20"
> >            maxIdle="10"
> >            maxWait="-1"
> >            name="jdbc/myName"
> >            password="myPassword"
> >            type="javax.sql.DataSource"
> >            url="jdbc:oracle:thin:@//localhost:8080/MYDBS"
> >            username="myUsername"
> >             />
> > </Context>
> 
> Well, you can use validationQuery parameter with "SELECT 1 FROM
> DUAL;". 

+1

Try adding validationQuery="SELECT 1 FROM DUAL" and testOnBorrow="true".

When you restart the DB, it's going to disconnect all of the connections
in your pool.  If you add a validation query and one of the "testOn*"
options (testOnBorrow is my personal favorite) then the pool will catch
the bad connections, remove them and assuming your DB is back online,
create new ones.

Dan

Re: DB Connection error

Posted by Chema <de...@gmail.com>.
> Try adding validationQuery="SELECT 1 FROM DUAL" and testOnBorrow="true".

testOnBorrow is true by default   :-)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: DB Connection error

Posted by Daniel Mikusa <dm...@vmware.com>.
On Tue, 2012-01-03 at 10:47 -0800, Chema wrote:
> > But in my application I have context.xml with following
> >
> > <Context antiJARLocking="true" path="/myApp">
> > <Resource auth="Container"
> >            driverClassName="oracle.jdbc.driver.OracleDriver"
> >            maxActive="20"
> >            maxIdle="10"
> >            maxWait="-1"
> >            name="jdbc/myName"
> >            password="myPassword"
> >            type="javax.sql.DataSource"
> >            url="jdbc:oracle:thin:@//localhost:8080/MYDBS"
> >            username="myUsername"
> >             />
> > </Context>
> 
> Well, you can use validationQuery parameter with "SELECT 1 FROM
> DUAL;". 

+1

Try adding validationQuery="SELECT 1 FROM DUAL" and testOnBorrow="true".

When you restart the DB, it's going to disconnect all of the connections
in your pool.  If you add a validation query and one of the "testOn*"
options (testOnBorrow is my personal favorite) then the pool will catch
the bad connections, remove them and assuming your DB is back online,
create new ones.

Dan

Re: DB Connection error

Posted by Chema <de...@gmail.com>.
> But in my application I have context.xml with following
>
> <Context antiJARLocking="true" path="/myApp">
> <Resource auth="Container"
>            driverClassName="oracle.jdbc.driver.OracleDriver"
>            maxActive="20"
>            maxIdle="10"
>            maxWait="-1"
>            name="jdbc/myName"
>            password="myPassword"
>            type="javax.sql.DataSource"
>            url="jdbc:oracle:thin:@//localhost:8080/MYDBS"
>            username="myUsername"
>             />
> </Context>

Well, you can use validationQuery parameter with "SELECT 1 FROM
DUAL;". I'v never used it but you can test it
And take a look at http://commons.apache.org/dbcp/configuration.html

If you can send us what is the exact error that your web app returns ...

Bye

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: DB Connection error

Posted by Anjib Mulepati <an...@hotmail.com>.
On 1/3/2012 1:12 PM, Chema wrote:
> 2012/1/3 Anjib Mulepati<an...@hotmail.com>:
>> Hi All,
>>
>> One simple question If I have JINDI configuration in my application will my
>> application reconnect to the DB whenever my DB gets restart.
>> I am having DB connection problem every Monday since our DB get restarted on
>> weekends which we don't have control of.
>> I am using Tomcat 6.0.20
> Hi:
>
> can you attach your<Resource/>  element in server.xml file ( except
> sensible data )?

I haven't change anythign in server.xml so i have default in it
<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container"
               type="org.apache.catalina.UserDatabase"
               description="User database that can be updated and saved"
               factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
               pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>

But in my application I have context.xml with following

<Context antiJARLocking="true" path="/myApp">
<Resource auth="Container"
             driverClassName="oracle.jdbc.driver.OracleDriver"
             maxActive="20"
             maxIdle="10"
             maxWait="-1"
             name="jdbc/myName"
             password="myPassword"
             type="javax.sql.DataSource"
             url="jdbc:oracle:thin:@//localhost:8080/MYDBS"
             username="myUsername"
              />
</Context>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: DB Connection error

Posted by Chema <de...@gmail.com>.
2012/1/3 Anjib Mulepati <an...@hotmail.com>:
> Hi All,
>
> One simple question If I have JINDI configuration in my application will my
> application reconnect to the DB whenever my DB gets restart.
> I am having DB connection problem every Monday since our DB get restarted on
> weekends which we don't have control of.
> I am using Tomcat 6.0.20

Hi:

can you attach your <Resource/> element in server.xml file ( except
sensible data )?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: DB Connection error

Posted by Pid <pi...@pidster.com>.
On 03/01/2012 17:08, Anjib Mulepati wrote:
> Hi All,
> 
> One simple question If I have JINDI configuration in my application will
> my application reconnect to the DB whenever my DB gets restart.
> I am having DB connection problem every Monday since our DB get
> restarted on weekends which we don't have control of.
> I am using Tomcat 6.0.20

In addition to the other advice, upgrade your Tomcat: that one is
extremely old.


p


> Thanks
> Anjib
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


-- 

[key:62590808]