tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose María Zaragoza <demablo...@gmail.com>
Subject Re: jdbc check available database
Date Tue, 09 Aug 2016 09:38:43 GMT
2016-08-09 10:52 GMT+02:00 Andrea Galli <andrea.galli@tp-italia.com>:
> Thank you Christoph , but in this how-to there isn't any example for SQL
> Server.

This is my configuration (context.xml) for a SQL Server connection pool

<Resource auth="Container" type="javax.sql.DataSource"
 factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
 driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
 initialSize="0"  maxActive="100" maxIdle="20" maxWait="10000" mindIdle="0"
 name="datasource/test" password="xxxxxx" removeAbandoned="true"
 url="jdbc:sqlserver://x.x.x.x;databaseName=Test;LoginTimeout=3"
 username="xxxxxx" validationQuery="SELECT 1" testOnBorrow="true" />

You need a SQL Server JDBC driver


>
> -----Messaggio originale-----
> Da: Christoph Nenning [mailto:Christoph.Nenning@lex-com.net]
> Inviato: martedì 2 agosto 2016 09:44
> A: Tomcat Users List <users@tomcat.apache.org>
> Oggetto: Re: jdbc check available database
>
>> Hello guys,
>>
>> I’ve SQL Server database with Tomcat 7 and, when I restart only
> database,
>>  webapps on Tomcat didn’t works , it show me error to connect to
> database ..
>>
>> In webapp context I use jdbc driver for connect, so there is a kind of
>> method for retry to connect to database when it return available?
>>
>>
>>
>
> Hi,
>
> I suggest to use a DataSource instead of dealing with jdbc connections on
> your own.
>
> see:
> http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html
>
>
> Regards,
> Christoph
>
>
> This Email was scanned by Sophos Anti Virus
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message