You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Konstantin Kolinko (Confluence)" <no...@apache.org> on 2019/11/24 19:30:08 UTC

[CONF] Apache Tomcat > Database

There's **1 new edit** on this page  
---  
|  
---  
|  | [![page icon](cid:page-
icon)](https://cwiki.apache.org/confluence/display/TOMCAT/Database?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574623808177&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=view
"page icon")  
---  
[Database](https://cwiki.apache.org/confluence/display/TOMCAT/Database?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574623808177&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=view
"Database")  
|  |  |  |  | ![](cid:avatar_892fc5b633a433d86a56f192323474ea) |  | Konstantin
Kolinko edited this page  
---  
|  
|  | Here's the version comment  
---  
|  
---  
|  |  | ![](cid:avatar_892fc5b633a433d86a56f192323474ea) |  | Konstantin
Kolinko edited at [07:22
PM](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=103098844)  
---  
|  |  |  Add a permalink. Fix formatting. Convert links to https.  
---  
|  
|  | Here's what changed:  
---  
|

_Permalink_ to this page: [
https://cwiki.apache.org/confluence/x/3CklBg](https://cwiki.apache.org/confluence/x/3CklBg)

## Preface

This page is to discuss database error and DBCP. Until more content can appear
here, here are some links to the mail archives to perform some searches:

  * [database](https://marc.info/?l=tomcat-user&w=2&r=1&s=database&q=b)
  * [datasource](https://marc.info/?l=tomcat-user&w=2&r=1&s=datasource&q=b)
  * [oracle](https://marc.info/?l=tomcat-user&w=2&r=1&s=oracle&q=b)
  * [mysql](https://marc.info/?l=tomcat-user&w=2&r=1&s=mysql&q=b)
  * [dbpool](https://marc.info/?l=tomcat-user&w=2&r=1&s=dbpool&q=b)

Other Links of interest:

  * [JNDI Datasource HOW-TO](https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html)

## Questions

  1. [Is it safe to use JDBC-ODBC bridge in production environment?](/confluence/pages/viewpage.action?pageId=103098844)
  2. [How to use Orache thin driver?](/confluence/pages/viewpage.action?pageId=103098844)
  3. [How to use JDBC 3 driver with Tomcat 8?](/confluence/pages/viewpage.action?pageId=103098844)

## Answers

###  |
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q1  
---|---  
| Q1  
Is it safe to use JDBC-ODBC bridge in production environment?

No, do not use JDBC-ODBC bridge bundled with Sun's JDK with Tomcat. It was
never meant for a production server environment. If you ask a question about
it, everyone will tell you to not use it. If you do need to use ODBC, there
are 3rd party drivers which do a pretty good job at being thread safe.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q2  
---|---  
| Q2  
How to use Orache thin driver?

If you use the oracle Oracle thin driver, be sure to rename it to a jar file
from a zip file. Tomcat only auto-magically loads files ending in .jar placed
in a lib directory. It ignores all other file extensions.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q3  
---|---  
| Q3  
How to use JDBC 3 driver with Tomcat 8 / DBCP 2?

One of the connection pool implementations in Tomcat 8 is DBCP 2, and DBCP 2
calls Connection.isValid(int) method when no validationQuery is specified.
IsValid(int) method is introduced with JDBC 4. If you must use JDBC 3 driver
with Tomcat 8 / DBCP 2, make sure that you specify `validationQuery` attribute
in pool configuration.

...  
  
|  |  | [Go to page
history](https://cwiki.apache.org/confluence/pages/viewpreviousversions.action?pageId=103098844&src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574623808177&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db "Go to page
history")  
---  
---  
| [View
page](https://cwiki.apache.org/confluence/display/TOMCAT/Database?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574623808177&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=view)  
---  
  
|  | [Stop watching
space](https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=TOMCAT&src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574623808177&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=stop-
watching&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ4c3JmOjhhYTk4MDk1NjlkNDIzY2QwMTZhMDQxMzMwNmYwMGRiIiwicXNoIjoiYzIzMmMyZTM0ZmQyMzk2NTMzZTRlZjEwODYzZTE3OWMyNmNhOGU4NmViMzZhOWE3M2M1M2Y2YzdmMDBjNzlmMiIsImlzcyI6ImNvbmZsdWVuY2Vfbm90aWZpY2F0aW9uc0FSRUgtWFVEMS1QT1FHLUNTQU8iLCJleHAiOjE1NzUyMjg2MDgsImlhdCI6MTU3NDYyMzgwOH0.cPDVzOJI15CtbDQv0Jbm4tvHMEDvVEZMkyfAwZmF4bg)
| •  
---|---  
[Manage
notifications](https://cwiki.apache.org/confluence/users/editmyemailsettings.action?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574623808177&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=manage)  
---  
| ![Confluence logo big](cid:footer-desktop-logo)  
---  
This message was sent by Atlassian Confluence 6.15.8  
![](cid:footer-mobile-logo)  
---