Showing posts with label queries. Show all posts
Showing posts with label queries. Show all posts

Tuesday, March 20, 2012

"Too many sessions open"

Hi. I have a program that performs a lot of queries (it's not exactly optimized yet) and I'm getting a "too many sessions" exception. I'm not clear on what a "session" is exactly because for one thing I only have one thread doing any real work, and I thought I only had one connection open for the entire application.

Am I forgetting to dispose of some resource or close a "session"?

I'm not using anything to do with transactions as all of my operations are atomic.

Could you please explain to me exactly what a session is, relative to connection and transaction. Thanks.P.S.
I'm doing most of my work through ExecuteResultSet() methods and iterating the result sets via Read() and Get...().|||

Did you find a solution for this? I'm running into the same problem. Any help is appreciated.

|||Use Data access block library, it is realy usefull

"Too many sessions open"

Hi. I have a program that performs a lot of queries (it's not exactly optimized yet) and I'm getting a "too many sessions" exception. I'm not clear on what a "session" is exactly because for one thing I only have one thread doing any real work, and I thought I only had one connection open for the entire application.

Am I forgetting to dispose of some resource or close a "session"?

I'm not using anything to do with transactions as all of my operations are atomic.

Could you please explain to me exactly what a session is, relative to connection and transaction. Thanks.
P.S.
I'm doing most of my work through ExecuteResultSet() methods and iterating the result sets via Read() and Get...().
|||

Did you find a solution for this? I'm running into the same problem. Any help is appreciated.

|||Use Data access block library, it is realy usefull

Tuesday, March 6, 2012

"dynamical" view

Hi,

I'm currently migrating an MS Access database to SQL 2000 Standard, and i have a problem with queries migration.

In acccess, a screen allows me to view some informations depending on Criteria, and results are returned with a query (we'll call it Q1).

Then, when correct data are returned by the query Q1, some other queries compute sums, average, group by orders, based on Q1's results.

Now my question : as in sql server, a view cannot accept parameters, the solution i adopted is :

- create a generic Q1 view, not filtered.

- then, all the subqueries based on this view are Functions or Stored procedures, which accepts parameters and do the filter on the main view (Q1).

The problem is that writing such functions or stored procedures is quite long, and interface code has to be deeply modified to use these parameters.

First, I had the idea of creating a temporary table, in which i would have inserted the good data, an the other queries would have used it. Unfortunately, views can't use temporary tables.

Any good idea is expected. Thanks in advance,

So, i found a first way to do this, maybe not the best, but it seems to work correctly.

I generate the script to dynamically generate the view with the correct "where" statements.

The view's name is MyView_ + Host_Id().

It should work since we don't use a citrix server for client hosting...