数据库重启后Tomcat需要重启(Tomcat need to restart after database restart)
我在Tomcat 7中部署了一个webapp。我在洞穴中配置了我的数据库池,如下所示。
<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" /> <Resource type="javax.sql.DataSource" name="jdbc/TEST" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/testdb?zeroDateTimeBehavior=convertToNull" username="test" password="test" initialSize="10" maxActive="100" maxIdle="50" minIdle="10"/>
这种配置工作正常。但我想配置我的数据库池,以便在数据库服务器停机一段时间后自动重新连接数据数据库服务器并重新启动。
I have a webapp deployed in Tomcat 7. There I cave configured my database pool as given below.
<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" /> <Resource type="javax.sql.DataSource" name="jdbc/TEST" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/testdb?zeroDateTimeBehavior=convertToNull" username="test" password="test" initialSize="10" maxActive="100" maxIdle="50" minIdle="10"/>
This configuration works fine.But I want to configure my database pool to reconnect data database server automatically when a database server down for sometime and started again.
原文:https://stackoverflow.com/questions/27358227
更新时间:2019-12-03 08:12
最满意答案
尝试添加
?autoReconnect的= TRUE
在你的网址中。
I found an answer for this problem. Below configuration done the job.
<Resource type="javax.sql.DataSource" name="jdbc/TEST" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/testdb?zeroDateTimeBehavior=convertToNull" validationQuery="select 1" validationInterval="30000" testWhileIdle="true" testOnBorrow="true" testOnReturn="false" username="test" password="test" initialSize="10" maxActive="100" maxIdle="50" minIdle="10"/>
2014-12-09
相关问答
更多显示由fineuploder上传到Amazon S3的图片?(Display images uploaded by fineuploder to Amazon S3?)
该错误消息表明服务器端密钥没有适当的权限来在相关存储桶上进行ListObjects或某些相关调用。 您需要重新评估与服务器端密钥关联的IAM用户/组,并确保它具有所有必需的已分配权限。 The error message suggests that the server-side key does not have proper permissions to make a ListObjects or some related call on the bucket in question. Yo
如何根据数据框和numpy中的协变量对观测进行分类?(How to classify observations based on their covariates in dataframe and numpy?)
在回答你的上一个问题时,我绝对认为pandas是一个很好的工具; 它可以在numpy中完成,但是在处理数据帧时,pandas可以说更直观,并且对于大多数应用程序而言足够快。 pandas和numpy也很好地一起玩。 例如,在您的情况下,您可以使用numpy.select来构建您的pandas列: import numpy as np
import pandas as pd
# Lay out your conditions
conditions = [((df.X1 < 0.5) & (df.
传递触发器结束日期时的C#Quartz警报(C# Quartz alert when trigger end date is passed)
您可以实现ISchedulerListener并侦听TriggerFinalized事件,该事件通知给定的触发器将永远不会根据其计划再次触发。 You can implement ISchedulerListener and listen for TriggerFinalized event that informs that the given trigger will never fire again according to its schedule.
.NET Core注册具有不同参数数量的原始通用(.NET Core Register Raw Generic with Different Number of Parameters)
您可以使用Reflection创建自己的扫描实现,以使用单行注册多个类型。 ServiceCollectionExtensions 在这里,我们实现了一个简单的Scan扩展方法,允许您选择一个接口(无论是通用的还是非泛型的),并且将为所有提供的程序集注册该接口的所有实现。 public static class ServiceCollectionExtensions
{
public static IServiceCollection Scan(
this IServic
什么Java API数据结构对HTML树有用?(What Java API data structure is good for HTML trees?)
不要重新发明轮子,只需使用像Jsoup这样的HTML解析器,你就可以通过使用方法Element#select(cssQuery)的CSS selector来获取你的标签。 Document doc = Jsoup.parse(file, encoding);
Elements elements = doc.select(cssQuery);
Don't reinvent the wheel, just use an HTML parser like Jsoup, you will be abl
在两个文件中找到类似的列(Find the similar columns in two files)
这是一个算法,用两个未分类的文件做你想要的。 该算法的优点是只需要存储器中的一个文件,并且其时间复杂度在输入文件的长度之和中是线性的。 换句话说,该算法使用少量内存和时间 - 许多其他算法将占用更多空间或时间。 (@dede的答案似乎运行良好,比我的简单,但它使用更多的内存和更多的时间,这对于大型输入文件非常明显。) 首先,逐行读取第一个文件,然后从中构建一个字典。 每个键是一行中前两个项的元组,相应的值是该行的其余部分。 在你的第二个例子中,结果字典将是 {('Brad', 'Pitt'):
将HTML控件放在Silverlight应用程序的顶部,并使其与应用程序一起滚动(Placing a HTML control over top of a Silverlight Application and have it scroll with the application)
通过捕获滚动事件,我能够调整我的控件的顶级属性,并允许滚动效果。 这是解决方案的基础。 注意:svMainViewer是MainShell.xaml页面中的滚动视图 C#MainShell.xaml.cs代码 public partial class MainShell : UserControl
{
#region Private Variables
private double svHorizontalOffset;
private double svVertical
Java Recursion - 来自几个递归调用的输出(Java Recursion - Output from several recursive calls)
这条线 currentSet = new ArrayList<>(currentSet);
是Java方式来调用复制构造函数,即您正在创建新的ArrayList,它最初具有旧列表中的所有元素。 但是,原始列表和新列表是独立的,因此新列表中的任何更改都不会反映到原始列表中。 这在您的算法中很重要,因为这些行: currentSet.add(a);
returnSet = combSum(candidates, target, i + a, retu