You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by al...@renfrewshire.gov.uk on 2013/01/29 17:54:57 UTC

JNDI Feedback

Hello,

Running Tomcat 7.0.29 on Windows XP Professional Service Pack 3

I have been handed a project developed by a former colleague and I am 
still learning Java and Tomcat.

The project has 4 JNDI's set up, 2 Oracle and 2 SQL Server with validation 
queries set up for the Oracle databases.  I want to set up validation 
queries on the JNDI's for SQL server and also have the JNDI provide 
feedback to the Java application if the database is down.

Can you advise how to do this please?  If not possible, then what is an 
alternative?

Thank you in advance for any assistance.

Regards

Alan Farroll
Analyst Programmer
Finance and Corporate Services
Renfrewshire House
Cotton Street
Paisley
PA1 1HY

0141 618 7961
alan.farroll@renfrewshire.gov.uk
www.renfrewshire.gov.uk

**********************************************************************

Renfrewshire Council Website - http://www.renfrewshire.gov.uk

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they  are addressed. If you have received this email in error please notify the system manager.

Renfrewshire Council may, in accordance with  the Telecommunications(Lawful Business Practice) (Interception of Communications) Regulations 2000, intercept e-mail messages for the purpose of monitoring or keeping a record of communications on the Council's system. If a message contains inappropriate dialogue it will automatically be intercepted by the Council's Internal Audit section who will decide whether or not the e-mail should be onwardly transmitted to the intended recipient(s).

This footnote also confirms that this email message has been swept by Sophos for the presence of computer viruses.

**********************************************************************



Re: JNDI Feedback

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Alan,

On 1/29/13 12:24 PM, alan.farroll@renfrewshire.gov.uk wrote:
> Thanks for feedback.  If a SQLException can be returned then I
> could probably use that in the Java application to determine if an
> exception occurred.  Can you provide any guidance?

Er.. not sure what guidance I could provide. You have to catch that
kind of exception somewhere that makes sense and then do something
about it. I can't tell you where that would be or what to do when you
caught it... it's up to your individual webapp's requirements.

Sorry...

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEICU4ACgkQ9CaO5/Lv0PDjnQCeMJwH5aiHBguGueakQZN26HT/
w+QAn3Eu+c5cwR0z3TuiLj3+jdayqKnZ
=6nd5
-----END PGP SIGNATURE-----

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


Re: JNDI Feedback

Posted by al...@renfrewshire.gov.uk.
Hi,

Thanks for feedback.  If a SQLException can be returned then I could 
probably use that in the Java application to determine if an exception 
occurred.  Can you provide any guidance?

Thank you

Regards

Alan Farroll
Analyst Programmer
Finance and Corporate Services
Renfrewshire House
Cotton Street
Paisley
PA1 1HY

0141 618 7961
alan.farroll@renfrewshire.gov.uk
www.renfrewshire.gov.uk



From:   Christopher Schultz <ch...@christopherschultz.net>
To:     Tomcat Users List <us...@tomcat.apache.org>
Date:   29/01/2013 17:11
Subject:        Re: JNDI Feedback



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Alan,

On 1/29/13 11:54 AM, alan.farroll@renfrewshire.gov.uk wrote:
> Running Tomcat 7.0.29 on Windows XP Professional Service Pack 3

Ready for a Microsoft upgrade cycle? The clock is ticking...

> I have been handed a project developed by a former colleague and I
> am still learning Java and Tomcat.

Welcome to the community!

> The project has 4 JNDI's set up

Nomenclature nit: that's "has 4 JNDI /resources/". JNDI itself is just
a directory interface where you stash stuff.

> 2 Oracle and 2 SQL Server with validation queries set up for the
> Oracle databases.  I want to set up validation queries on the
> JNDI's for SQL server and also have the JNDI provide feedback to
> the Java application if the database is down.

The only feedback you are going to get is (eventual) SQLExceptions.

> Can you advise how to do this please?  If not possible, then what
> is an alternative?

Obviously, you can set up a validationQuery in the 2 MS SQL Server
resources by just adding an appropriate query (e.g. "SELECT 1 FROM
DUAL" or whatever is appropriate in MS SQL Server) to the <Resource>
attributes.

Were you hoping to get some other behavior than just what
validationQuery already provides?

FYI if you are using Tomcat's default connection pool, then you are
using Apache commons-dbcp, whose configuration guide can be found
here: http://commons.apache.org/dbcp/configuration.html

That will explain all the configuration attributes you can use (right
in the XML) and what they all do.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEIAq0ACgkQ9CaO5/Lv0PBwvgCfd/QXbOkTEsCA4+dVG3GkhcYu
dOQAn0lAOIdxaok55TJCE5pu7jb+aR4t
=izRU
-----END PGP SIGNATURE-----

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




**********************************************************************

Renfrewshire Council Website - http://www.renfrewshire.gov.uk

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they  are addressed. If you have received this email in error please notify the system manager.

Renfrewshire Council may, in accordance with  the Telecommunications(Lawful Business Practice) (Interception of Communications) Regulations 2000, intercept e-mail messages for the purpose of monitoring or keeping a record of communications on the Council's system. If a message contains inappropriate dialogue it will automatically be intercepted by the Council's Internal Audit section who will decide whether or not the e-mail should be onwardly transmitted to the intended recipient(s).

This footnote also confirms that this email message has been swept by Sophos for the presence of computer viruses.

**********************************************************************



Re: JNDI Feedback

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Alan,

On 1/29/13 11:54 AM, alan.farroll@renfrewshire.gov.uk wrote:
> Running Tomcat 7.0.29 on Windows XP Professional Service Pack 3

Ready for a Microsoft upgrade cycle? The clock is ticking...

> I have been handed a project developed by a former colleague and I
> am still learning Java and Tomcat.

Welcome to the community!

> The project has 4 JNDI's set up

Nomenclature nit: that's "has 4 JNDI /resources/". JNDI itself is just
a directory interface where you stash stuff.

> 2 Oracle and 2 SQL Server with validation queries set up for the
> Oracle databases.  I want to set up validation queries on the
> JNDI's for SQL server and also have the JNDI provide feedback to
> the Java application if the database is down.

The only feedback you are going to get is (eventual) SQLExceptions.

> Can you advise how to do this please?  If not possible, then what
> is an alternative?

Obviously, you can set up a validationQuery in the 2 MS SQL Server
resources by just adding an appropriate query (e.g. "SELECT 1 FROM
DUAL" or whatever is appropriate in MS SQL Server) to the <Resource>
attributes.

Were you hoping to get some other behavior than just what
validationQuery already provides?

FYI if you are using Tomcat's default connection pool, then you are
using Apache commons-dbcp, whose configuration guide can be found
here: http://commons.apache.org/dbcp/configuration.html

That will explain all the configuration attributes you can use (right
in the XML) and what they all do.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEIAq0ACgkQ9CaO5/Lv0PBwvgCfd/QXbOkTEsCA4+dVG3GkhcYu
dOQAn0lAOIdxaok55TJCE5pu7jb+aR4t
=izRU
-----END PGP SIGNATURE-----

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


Re: JNDI Feedback

Posted by Daniel Mikusa <dm...@vmware.com>.
On Jan 29, 2013, at 12:18 PM, alan.farroll@renfrewshire.gov.uk wrote:

> Hi,
> 
> As requested, the resource tags from the Context file.  Although I was 
> asked by my boss to change password value to password and username value 
> to username.
> 
> <Resource auth="Container" 
> driverClassName="oracle.jdbc.driver.OracleDriver" 
> factory="org.moss.jdj.dbcp.EncryptedDataSourceFactory" maxActive="100" 
> maxIdle="30" maxWait="10000" name="jdbc/authentication" 
> password="password" type="javax.sql.DataSource" 
> url="jdbc:oracle:thin:@swtest:1523:TRNG" username="username" 
> validationQuery="select 1 from dual" />
> 
> <Resource auth="Container" 
> driverClassName="oracle.jdbc.driver.OracleDriver" 
> factory="org.moss.jdj.dbcp.EncryptedDataSourceFactory" maxActive="100" 
> maxIdle="30" maxWait="10000" name="jdbc/swift" password="password" 
> type="javax.sql.DataSource" url="jdbc:oracle:thin:@swtest:1523:TRNG" 
> username="username" validationQuery="select 1 from dual" />
> 
> <Resource auth="Container" 
> driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
> factory="org.moss.jdj.dbcp.EncryptedDataSourceFactory" maxActive="100" 
> maxIdle="30" maxWait="10000" name="jdbc/edrms" password="password" 
> type="javax.sql.DataSource" 
> url="jdbc:sqlserver://hqdcsqlc2\ngedm:2369;databaseName=ImagesTrainDM" 
> username="username" />

These three are using a custom "factory", so you'll want to check with the author of "org.moss.jdj.dbcp.EncryptedDataSourceFactory" to determine exactly what properties it supports.  I'm assuming that because the first two take a "validationQuery", the third should work with it as well.  You just need to adjust the query so that it works on MSSQL.  I think "SELECT 1" should work, but you'll want to double-check that.

> 
> <Resource auth="Container" 
> driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
> maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/audit" 
> password="password" type="javax.sql.DataSource" 
> url="jdbc:sqlserver://egovsql2005\p40010:1433;databaseName=AuditDEV" 
> username="username" />

This doesn't have a factory, so it'll use the default DBCP connection pool.  See Chris' email for a link to the docs for DBCP.

Dan

> 
> 
> Thank you
> 
> Regards
> 
> Alan Farroll
> Analyst Programmer
> Finance and Corporate Services
> Renfrewshire House
> Cotton Street
> Paisley
> PA1 1HY
> 
> 0141 618 7961
> alan.farroll@renfrewshire.gov.uk
> www.renfrewshire.gov.uk
> 
> 
> 
> From:   Daniel Mikusa <dm...@vmware.com>
> To:     "Tomcat Users List" <us...@tomcat.apache.org>
> Date:   29/01/2013 17:06
> Subject:        Re: JNDI Feedback
> 
> 
> 
> On Jan 29, 2013, at 11:54 AM, alan.farroll@renfrewshire.gov.uk wrote:
> 
>> Hello,
>> 
>> Running Tomcat 7.0.29 on Windows XP Professional Service Pack 3
>> 
>> I have been handed a project developed by a former colleague and I am 
>> still learning Java and Tomcat.
>> 
>> The project has 4 JNDI's set up, 2 Oracle and 2 SQL Server with 
> validation 
>> queries set up for the Oracle databases. 
> 
> Please include the configuration for your data sources.  The <Resource/> 
> tag, minus passwords should be sufficient.
> 
> Dan
> 
>> I want to set up validation 
>> queries on the JNDI's for SQL server and also have the JNDI provide 
>> feedback to the Java application if the database is down.
>> 
>> Can you advise how to do this please?  If not possible, then what is an 
>> alternative?
>> 
>> Thank you in advance for any assistance.
>> 
>> Regards
>> 
>> Alan Farroll
>> Analyst Programmer
>> Finance and Corporate Services
>> Renfrewshire House
>> Cotton Street
>> Paisley
>> PA1 1HY
>> 
>> 0141 618 7961
>> alan.farroll@renfrewshire.gov.uk
>> www.renfrewshire.gov.uk
>> 
>> **********************************************************************
>> 
>> Renfrewshire Council Website - http://www.renfrewshire.gov.uk
>> 
>> This email and any files transmitted with it are confidential and 
> intended solely for the use of the individual or entity to whom they  are 
> addressed. If you have received this email in error please notify the 
> system manager.
>> 
>> Renfrewshire Council may, in accordance with  the 
> Telecommunications(Lawful Business Practice) (Interception of 
> Communications) Regulations 2000, intercept e-mail messages for the 
> purpose of monitoring or keeping a record of communications on the 
> Council's system. If a message contains inappropriate dialogue it will 
> automatically be intercepted by the Council's Internal Audit section who 
> will decide whether or not the e-mail should be onwardly transmitted to 
> the intended recipient(s).
>> 
>> This footnote also confirms that this email message has been swept by 
> Sophos for the presence of computer viruses.
>> 
>> **********************************************************************
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 
> 
> **********************************************************************
> 
> Renfrewshire Council Website - http://www.renfrewshire.gov.uk
> 
> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they  are addressed. If you have received this email in error please notify the system manager.
> 
> Renfrewshire Council may, in accordance with  the Telecommunications(Lawful Business Practice) (Interception of Communications) Regulations 2000, intercept e-mail messages for the purpose of monitoring or keeping a record of communications on the Council's system. If a message contains inappropriate dialogue it will automatically be intercepted by the Council's Internal Audit section who will decide whether or not the e-mail should be onwardly transmitted to the intended recipient(s).
> 
> This footnote also confirms that this email message has been swept by Sophos for the presence of computer viruses.
> 
> **********************************************************************
> 
> 

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


Re: JNDI Feedback

Posted by al...@renfrewshire.gov.uk.
Hi,

As requested, the resource tags from the Context file.  Although I was 
asked by my boss to change password value to password and username value 
to username.

<Resource auth="Container" 
driverClassName="oracle.jdbc.driver.OracleDriver" 
factory="org.moss.jdj.dbcp.EncryptedDataSourceFactory" maxActive="100" 
maxIdle="30" maxWait="10000" name="jdbc/authentication" 
password="password" type="javax.sql.DataSource" 
url="jdbc:oracle:thin:@swtest:1523:TRNG" username="username" 
validationQuery="select 1 from dual" />

<Resource auth="Container" 
driverClassName="oracle.jdbc.driver.OracleDriver" 
factory="org.moss.jdj.dbcp.EncryptedDataSourceFactory" maxActive="100" 
maxIdle="30" maxWait="10000" name="jdbc/swift" password="password" 
type="javax.sql.DataSource" url="jdbc:oracle:thin:@swtest:1523:TRNG" 
username="username" validationQuery="select 1 from dual" />

<Resource auth="Container" 
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
factory="org.moss.jdj.dbcp.EncryptedDataSourceFactory" maxActive="100" 
maxIdle="30" maxWait="10000" name="jdbc/edrms" password="password" 
type="javax.sql.DataSource" 
url="jdbc:sqlserver://hqdcsqlc2\ngedm:2369;databaseName=ImagesTrainDM" 
username="username" />

<Resource auth="Container" 
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/audit" 
password="password" type="javax.sql.DataSource" 
url="jdbc:sqlserver://egovsql2005\p40010:1433;databaseName=AuditDEV" 
username="username" />


Thank you

Regards

Alan Farroll
Analyst Programmer
Finance and Corporate Services
Renfrewshire House
Cotton Street
Paisley
PA1 1HY

0141 618 7961
alan.farroll@renfrewshire.gov.uk
www.renfrewshire.gov.uk



From:   Daniel Mikusa <dm...@vmware.com>
To:     "Tomcat Users List" <us...@tomcat.apache.org>
Date:   29/01/2013 17:06
Subject:        Re: JNDI Feedback



On Jan 29, 2013, at 11:54 AM, alan.farroll@renfrewshire.gov.uk wrote:

> Hello,
> 
> Running Tomcat 7.0.29 on Windows XP Professional Service Pack 3
> 
> I have been handed a project developed by a former colleague and I am 
> still learning Java and Tomcat.
> 
> The project has 4 JNDI's set up, 2 Oracle and 2 SQL Server with 
validation 
> queries set up for the Oracle databases. 

Please include the configuration for your data sources.  The <Resource/> 
tag, minus passwords should be sufficient.

Dan

> I want to set up validation 
> queries on the JNDI's for SQL server and also have the JNDI provide 
> feedback to the Java application if the database is down.
> 
> Can you advise how to do this please?  If not possible, then what is an 
> alternative?
> 
> Thank you in advance for any assistance.
> 
> Regards
> 
> Alan Farroll
> Analyst Programmer
> Finance and Corporate Services
> Renfrewshire House
> Cotton Street
> Paisley
> PA1 1HY
> 
> 0141 618 7961
> alan.farroll@renfrewshire.gov.uk
> www.renfrewshire.gov.uk
> 
> **********************************************************************
> 
> Renfrewshire Council Website - http://www.renfrewshire.gov.uk
> 
> This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they  are 
addressed. If you have received this email in error please notify the 
system manager.
> 
> Renfrewshire Council may, in accordance with  the 
Telecommunications(Lawful Business Practice) (Interception of 
Communications) Regulations 2000, intercept e-mail messages for the 
purpose of monitoring or keeping a record of communications on the 
Council's system. If a message contains inappropriate dialogue it will 
automatically be intercepted by the Council's Internal Audit section who 
will decide whether or not the e-mail should be onwardly transmitted to 
the intended recipient(s).
> 
> This footnote also confirms that this email message has been swept by 
Sophos for the presence of computer viruses.
> 
> **********************************************************************
> 
> 

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




**********************************************************************

Renfrewshire Council Website - http://www.renfrewshire.gov.uk

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they  are addressed. If you have received this email in error please notify the system manager.

Renfrewshire Council may, in accordance with  the Telecommunications(Lawful Business Practice) (Interception of Communications) Regulations 2000, intercept e-mail messages for the purpose of monitoring or keeping a record of communications on the Council's system. If a message contains inappropriate dialogue it will automatically be intercepted by the Council's Internal Audit section who will decide whether or not the e-mail should be onwardly transmitted to the intended recipient(s).

This footnote also confirms that this email message has been swept by Sophos for the presence of computer viruses.

**********************************************************************



Re: JNDI Feedback

Posted by Daniel Mikusa <dm...@vmware.com>.
On Jan 29, 2013, at 11:54 AM, alan.farroll@renfrewshire.gov.uk wrote:

> Hello,
> 
> Running Tomcat 7.0.29 on Windows XP Professional Service Pack 3
> 
> I have been handed a project developed by a former colleague and I am 
> still learning Java and Tomcat.
> 
> The project has 4 JNDI's set up, 2 Oracle and 2 SQL Server with validation 
> queries set up for the Oracle databases.  

Please include the configuration for your data sources.  The <Resource/> tag, minus passwords should be sufficient.

Dan

> I want to set up validation 
> queries on the JNDI's for SQL server and also have the JNDI provide 
> feedback to the Java application if the database is down.
> 
> Can you advise how to do this please?  If not possible, then what is an 
> alternative?
> 
> Thank you in advance for any assistance.
> 
> Regards
> 
> Alan Farroll
> Analyst Programmer
> Finance and Corporate Services
> Renfrewshire House
> Cotton Street
> Paisley
> PA1 1HY
> 
> 0141 618 7961
> alan.farroll@renfrewshire.gov.uk
> www.renfrewshire.gov.uk
> 
> **********************************************************************
> 
> Renfrewshire Council Website - http://www.renfrewshire.gov.uk
> 
> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they  are addressed. If you have received this email in error please notify the system manager.
> 
> Renfrewshire Council may, in accordance with  the Telecommunications(Lawful Business Practice) (Interception of Communications) Regulations 2000, intercept e-mail messages for the purpose of monitoring or keeping a record of communications on the Council's system. If a message contains inappropriate dialogue it will automatically be intercepted by the Council's Internal Audit section who will decide whether or not the e-mail should be onwardly transmitted to the intended recipient(s).
> 
> This footnote also confirms that this email message has been swept by Sophos for the presence of computer viruses.
> 
> **********************************************************************
> 
> 

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