These queries all seem like an awful lot of unnecessary processing.  Here's what I use:

SELECT 1+1

-----Original Message-----
From: Antonio Fiol Bonnín [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 1:25 AM
To: Tomcat Users List
Subject: Re: Microsoft SQL Server validation query


For any database server I can think of:

CREATE TABLE validation ( dummy char(1) );
INSERT INTO validation VALUES ( 'X' ); -- and make sure you do this only 
once

And then use as a validation query:
SELECT * FROM validation;

Well. Yes. I am ashamed of reimplementing Oracle's "DUAL", but if you 
really want to know of a table that will always be there, provide it 
yourself.

And anyway, I mostly agree with Mike's statement about server-specific 
params in the config files: "Adding one more ... is not too much of a 
burden".

Only if you set the validation query from outside the config files, 
which is very unlikely, Mike's statement would not strictly apply IMHO.

Antonio Fiol

Derek Mahar wrote:

>Thank you to all of you for your quick replies.  It seems that the 
>connection pool validation query is not specific to any database server 
>implementation unless the query statement itself is server-specific 
>(that is, it refers to a special server system database, table, or 
>function).  I like the idea of querying the server for the date, but 
>I'm not sure that the date function is standard SQL and portable across 
>all server implementations.  Does anyone know otherwise?
>
>Derek
>
>-----Original Message-----
>From: Peter Lin [mailto:[EMAIL PROTECTED]
>Sent: January 8, 2004 10:35 AM
>To: Tomcat Users List
>Subject: RE: Microsoft SQL Server validation query
>
>
> 
>in the past I just select the date from sql server. unless you want to 
>test a specific table, but that has potential performance impact.
> 
>the safe simple query to see if sql server is alive is to just select 
>the date.
> 
>peter lin
>
>
>Allistair Crossley <[EMAIL PROTECTED]> wrote:
>I would not do that because that would return as many 1s as there are 
>rows in the table. Something like count(*) may not be the most 
>efficient but it returns just 1 row always. Also with using 1, you 
>cannot guarantee a row will come back.
>
>
>
>Allistair Crossley
>__________________________
>
>Intranet Senior Developer
>New Media Group, QAS Ltd
>Telephone: 020 7819 5343
>__________________________
>
>
>-----Original Message-----
>From: Michael Duffy [mailto:[EMAIL PROTECTED]
>Sent: 08 January 2004 15:25
>To: Tomcat Users List
>Subject: RE: Microsoft SQL Server validation query
>
>
>
>Or even "SELECT 1 FROM TABLE". No COUNT overhead, if
>any. - MOD
>
>
>--- Allistair Crossley
>wrote:
>  
>
>>i think you could use anything .. maybe
>>
>>SELECT COUNT(*) FROM table
>>
>>The dual table is an oracle dummy table and is quite
>>handy, but I think the validation query can just be
>>any old select statement that should return true a
>>result always.
>>
>>ADC
>>
>>-----Original Message-----
>>From: Derek Mahar [mailto:[EMAIL PROTECTED]
>>Sent: 08 January 2004 15:15
>>To: Tomcat Users List
>>Subject: Microsoft SQL Server validation query
>>
>>
>>Does anyone happen to know which validation query I
>>should use for
>>Microsoft SQL Server?
>>
>>Derek
>>
>>
>>    
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to