什么是关于数据库和JNDI的validationQuery? [英] What is a validationQuery with respect to databases and JNDI?

查看:877
本文介绍了什么是关于数据库和JNDI的validationQuery?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎遇到了与的海报相同的问题这个原始的SO问题



问题是,他回答了自己的问题,并提出以下意见:


我解决了我的问题,我向我的JNDI数据源添加了一个validationQuery。


对我来说并不意味着什么,也不能帮助我解决我的问题。所以我问:什么是相对于我的数据库(Sybase)和用于保存服务器查找信息的JNDI条目的 validationQuery



提前感谢。

解决方案

验证查询是由数据源运行的查询,在返回之前,连接仍处于打开状态。这里是Tomcat的验证查询的定义;向下滚动到4.配置Tomcat的资源工厂部分的中间,寻找validationQuery属性。



EDIT >

根据此答案,如果验证查询失败,则没有错误抛出将会删除坏的/关闭的连接,并创建另一个连接来替换它。


I seem to be having the same exact problem as the poster of this original SO question.

The problem is, he answered his own question with the following comment:

I solved my problem, I added a validationQuery to my JNDI datasource.

Unfortunately, that doesn't mean anything to me, and doesn't help me solve my problem. So I ask: what is a "validationQuery" with respect to my database (Sybase) and the JNDI entry used to hold the server lookup info?

Thanks in advance.

解决方案

The validation query is a query run by the data source to validate that a Connection is still open before returning it. Here's Tomcat's definition of a validation query; scroll down to the middle of section "4. Configure Tomcat's Resource Factory", looking for the "validationQuery" attribute.

EDIT

According to this answer, if the validation query fails, no error is thrown; the bad/closed connection is dropped and another connection is created to replace it.

这篇关于什么是关于数据库和JNDI的validationQuery?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆