Showing posts with label threads. Show all posts
Showing posts with label threads. Show all posts

Sunday, March 25, 2012

ActiveX to warm up Report Server ?

Because the IIS threads are recycled at night, the first user that calls up Report Manager in the morning has to wait 30 seconds before the page loads, as IIS is creating a thread.

I'd like to set up a job in SQL Agent that will navigate to http://localhost/reports/ every morning before users come in to work, so they won't have to wait.

I think a SAL Agent job of type ActiveX Script would be suitable for this, so I need to write the code to navigate to the reports page in VBScript.

Anyone knows how to navigate to a page in VBScript ?

tia.

I meant SQL Agent job, of course, not SAL.|||

Schedule a job with a simple plain empty record and schedule this before the needed time.

Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

I know how to schedule a job, but what is a "plain empty record" ? I have lots of RS subscriptions scheduled already and they don't affect the way the first user has to wait 30 secs for Report Manager to load up.

What I wanted to know was how to navigate to the report manager home page in VBScript. I couldn't find any example anywhere.

|||

This isnt a solution that you are looking for but maybe you dont need to reschedule the IIS worker process every night? My reportserver serves up about 800 reports per week and its hosted on a server which also hosts 9 other web applications.

I have set it in IIS that the worker process for report server does not recycle at all, and so far it hasnt recycled for 6 weeks. I occasionally manually recycle it and then go straight to the report server home page to start up the server quickly again.

Depends on your environment but maybe you dont need to recycle it every night.

sql

Friday, February 24, 2012

accessing the same database using multiple threads

hi,

do i need to use specially synchronized code if i have multiple threads inserting, updating and reading rows to and from the same database? in this case, i know that no 2 threads will try to insert or update the exact same row into the DB, however, multiple threads might try to read the same row from the database.

thanks!

No, if the threads are using different conenction objects you can use your code as you already might have implemented it. In case of reusing a SQLConnection object (using an instance or a singleton object) you will have to make sure that the connection does not already has an open transction as parallel transactions are not allowed (if you

are using explicit transactions9

Jens K. Suessmeyer


http://www.sqlserver2005.de

|||

ok cool fanks!!

Thursday, February 16, 2012

Accessing SQL Server 2005 from C# using multithreaded application

I have a C# program that access SQL Server 2005. The program have 4 threads that performs the same method and are used only to improve performance of the system

The C# accesses the SQL Server using OleDbConnection and

OleDbCommand classes. Sometimes (very rare) I get exception to method ExecuteNonQuery() with message: "Table does not exist.".

The command text for the query is a constant string in the format: "insert into my_table…".

Can any one tell me what could be the problem?

Please give more information regarding the following questions:

a. Are these 4 threads sharing the same SqlConnection?

b. Is the table my_table created before you start these 4 threads? Or are they created inside one or more of these threads?

c. What else do you run in the threads apart from the INSERT INTO my_table?

d. Do you Open and Close the SqlConnection in these threads?

One possibility that I can think of is that the SqlCommand maybe running under a different database context, hence the server cannot find the table you specified. But I need to understand your application better in order to find out the exact reason.

Ping

|||

Thanks for your response!!

Here are the answers:

a. Are these 4 threads sharing the same SqlConnection?

Answer: Each thread work on its own connection, i.e. we have 4 connections.

b. Is the table my_table created before you start these 4 threads? Or are they created inside one or more of these threads?

Answer: The table is created before the threads are started.

c. What else do you run in the threads apart from the INSERT INTO my_table?

Answer: Each thread make several inserts to the same table and also execute a store procedure (the same one with different parameters).

d. Do you Open and Close the SqlConnection in these threads?

Answer: Each thread open a connection, make serveral inserts and execute a store procedure and then close the connection and terminates. Whenever the thread is terminated another thread is started until all the work is done.

|||

Thanks for your response!!

Here are the answers:

a. Are these 4 threads sharing the same SqlConnection?

Answer: Each thread work on its own connection, i.e. we have 4 connections.

b. Is the table my_table created before you start these 4 threads? Or are they created inside one or more of these threads?

Answer: The table is created before the threads are started.

c. What else do you run in the threads apart from the INSERT INTO my_table?

Answer: Each thread make several inserts to the same table and also execute a store procedure (the same one with different parameters).

d. Do you Open and Close the SqlConnection in these threads?

Answer: Each thread open a connection, make serveral inserts and execute a store procedure and then close the connection and terminates. Whenever the thread is terminated another thread is started until all the work is done.


|||

Hi,

What you could do is to capture a detailed SQL Profiler trace and examine the statements around the error occurrence. This would give you an idea why the ExecuteNonQuery is getting the non-exist error.

HTH,
Jivko Dobrev - MSFT
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||

i have a very weird thing going on in my application program..

you see..

my c# application program has an sql connection..

and it can save records..

but as soon as i stop debigging it

and then re-run it again..

all the records saved in my Database

literally disappears.!!

i need help..

please help out a young kid here...T_T

Accessing SQL Server 2005 from C# using multithreaded application

I have a C# program that access SQL Server 2005. The program have 4 threads that performs the same method and are used only to improve performance of the system

The C# accesses the SQL Server using OleDbConnection and

OleDbCommand classes. Sometimes (very rare) I get exception to method ExecuteNonQuery() with message: "Table does not exist.".

The command text for the query is a constant string in the format: "insert into my_table…".

Can any one tell me what could be the problem?

Please give more information regarding the following questions:

a. Are these 4 threads sharing the same SqlConnection?

b. Is the table my_table created before you start these 4 threads? Or are they created inside one or more of these threads?

c. What else do you run in the threads apart from the INSERT INTO my_table?

d. Do you Open and Close the SqlConnection in these threads?

One possibility that I can think of is that the SqlCommand maybe running under a different database context, hence the server cannot find the table you specified. But I need to understand your application better in order to find out the exact reason.

Ping

|||

Thanks for your response!!

Here are the answers:

a. Are these 4 threads sharing the same SqlConnection?

Answer: Each thread work on its own connection, i.e. we have 4 connections.

b. Is the table my_table created before you start these 4 threads? Or are they created inside one or more of these threads?

Answer: The table is created before the threads are started.

c. What else do you run in the threads apart from the INSERT INTO my_table?

Answer: Each thread make several inserts to the same table and also execute a store procedure (the same one with different parameters).

d. Do you Open and Close the SqlConnection in these threads?

Answer: Each thread open a connection, make serveral inserts and execute a store procedure and then close the connection and terminates. Whenever the thread is terminated another thread is started until all the work is done.

|||

Thanks for your response!!

Here are the answers:

a. Are these 4 threads sharing the same SqlConnection?

Answer: Each thread work on its own connection, i.e. we have 4 connections.

b. Is the table my_table created before you start these 4 threads? Or are they created inside one or more of these threads?

Answer: The table is created before the threads are started.

c. What else do you run in the threads apart from the INSERT INTO my_table?

Answer: Each thread make several inserts to the same table and also execute a store procedure (the same one with different parameters).

d. Do you Open and Close the SqlConnection in these threads?

Answer: Each thread open a connection, make serveral inserts and execute a store procedure and then close the connection and terminates. Whenever the thread is terminated another thread is started until all the work is done.


|||

Hi,

What you could do is to capture a detailed SQL Profiler trace and examine the statements around the error occurrence. This would give you an idea why the ExecuteNonQuery is getting the non-exist error.

HTH,
Jivko Dobrev - MSFT
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||

i have a very weird thing going on in my application program..

you see..

my c# application program has an sql connection..

and it can save records..

but as soon as i stop debigging it

and then re-run it again..

all the records saved in my Database

literally disappears.!!

i need help..

please help out a young kid here...T_T