I have done this successfully -- at least setting ARITHABORT to ON. I haven't tried turning it off, but I don't know why it would ever be necessary to do so. We had the same need to enable ARITHABORT so that we can use indexed views... indexed views are about three times faster for our most common queries so turning on ARITHABORT is very useful!
I did it by including "SET ARITHABORT ON;" in the validation query on my connection pool. That ensures that every time a connection is added to the pool, it has ARITHABORT set to on. Because the settings of ARITHABORT apply for the rest of the session, all queries run with ARITHABORT on.
Exactly how do you do it? It depends on how you connect to the database. Here is what I have:
- Hibernate, uses
- DBCP Connection Pool, uses
- jDTS Driver, connects to
- SQL Server 2000
So I set ARITHABORT in the validation query for DBCP, like this:
Code:
<property name="dbcp.validationQuery">
SET ARITHABORT ON; SELECT TOP 1 ID FROM ExampleTable
</property>
You would need to change the column and table names in the SELECT query to something in your database.