473,403 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Threading and database connections

I have an application that kicks off a long process on the database
server with a separate thread and then forwards the user to another
page which monitors the progress of this process by reading a table
that is being updated by the long process. On my development machine
it works fine but when I try to deploy the app to a server the long
process is blocked from database access. Apparently when the new
thread is created it either does not get or loses its credentials. On
my dev machine it is not a problem because it simply reverts back to my
credentials but on the server it reverts back to the default IIS user.
How can I work around this?

Nov 9 '06 #1
5 1372
Is this a web app?

Are you using imporsonate ?

"ja*************@gmail.com" wrote:
I have an application that kicks off a long process on the database
server with a separate thread and then forwards the user to another
page which monitors the progress of this process by reading a table
that is being updated by the long process. On my development machine
it works fine but when I try to deploy the app to a server the long
process is blocked from database access. Apparently when the new
thread is created it either does not get or loses its credentials. On
my dev machine it is not a problem because it simply reverts back to my
credentials but on the server it reverts back to the default IIS user.
How can I work around this?

Nov 9 '06 #2
If you want, you can have the process run under the credentials of a user
that has the required database access. In web.config,
<identity impersonate="true" userName="theUser" password = "thePassword' />

Bear in mind that this does expose some security issues, but try it first
because it is a very "easy fix".
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"ja*************@gmail.com" wrote:
I have an application that kicks off a long process on the database
server with a separate thread and then forwards the user to another
page which monitors the progress of this process by reading a table
that is being updated by the long process. On my development machine
it works fine but when I try to deploy the app to a server the long
process is blocked from database access. Apparently when the new
thread is created it either does not get or loses its credentials. On
my dev machine it is not a problem because it simply reverts back to my
credentials but on the server it reverts back to the default IIS user.
How can I work around this?

Nov 10 '06 #3
I added the line in the web.config file you suggested. It doesn't
appear that the processing thread ever proceeds. The monitor page is
updating properly. If I add records to the table it is monitoring it
appears on the status page.
Peter wrote:
If you want, you can have the process run under the credentials of a user
that has the required database access. In web.config,
<identity impersonate="true" userName="theUser" password = "thePassword' />

Bear in mind that this does expose some security issues, but try it first
because it is a very "easy fix".
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"ja*************@gmail.com" wrote:
I have an application that kicks off a long process on the database
server with a separate thread and then forwards the user to another
page which monitors the progress of this process by reading a table
that is being updated by the long process. On my development machine
it works fine but when I try to deploy the app to a server the long
process is blocked from database access. Apparently when the new
thread is created it either does not get or loses its credentials. On
my dev machine it is not a problem because it simply reverts back to my
credentials but on the server it reverts back to the default IIS user.
How can I work around this?
Nov 10 '06 #4
If you are using SQL Server, you can just supply a SQL Server login uid and
pwd in your connection string instead of using Windows Authentication,
provided that mixed mode authentication is enabled.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"ja*************@gmail.com" wrote:
I added the line in the web.config file you suggested. It doesn't
appear that the processing thread ever proceeds. The monitor page is
updating properly. If I add records to the table it is monitoring it
appears on the status page.
Peter wrote:
If you want, you can have the process run under the credentials of a user
that has the required database access. In web.config,
<identity impersonate="true" userName="theUser" password = "thePassword' />

Bear in mind that this does expose some security issues, but try it first
because it is a very "easy fix".
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"ja*************@gmail.com" wrote:
I have an application that kicks off a long process on the database
server with a separate thread and then forwards the user to another
page which monitors the progress of this process by reading a table
that is being updated by the long process. On my development machine
it works fine but when I try to deploy the app to a server the long
process is blocked from database access. Apparently when the new
thread is created it either does not get or loses its credentials. On
my dev machine it is not a problem because it simply reverts back to my
credentials but on the server it reverts back to the default IIS user.
How can I work around this?
>
>

Nov 10 '06 #5
Thanks so much for your help. Once I followed your advice I was able
to see that the problem was not the tread but the permissions on the
database. Apparently it was using my privileges when updating but it
was defaulting to the application default when control was passed. The
default privileges were not enough on a couple of tables so the tread
was bombing out without any indication as to why.
Peter wrote:
If you are using SQL Server, you can just supply a SQL Server login uid and
pwd in your connection string instead of using Windows Authentication,
provided that mixed mode authentication is enabled.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"ja*************@gmail.com" wrote:
I added the line in the web.config file you suggested. It doesn't
appear that the processing thread ever proceeds. The monitor page is
updating properly. If I add records to the table it is monitoring it
appears on the status page.
Peter wrote:
If you want, you can have the process run under the credentials of a user
that has the required database access. In web.config,
<identity impersonate="true" userName="theUser" password = "thePassword' />
>
Bear in mind that this does expose some security issues, but try it first
because it is a very "easy fix".
Peter
>
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
>
>
>
>
"ja*************@gmail.com" wrote:
>
I have an application that kicks off a long process on the database
server with a separate thread and then forwards the user to another
page which monitors the progress of this process by reading a table
that is being updated by the long process. On my development machine
it works fine but when I try to deploy the app to a server the long
process is blocked from database access. Apparently when the new
thread is created it either does not get or loses its credentials. On
my dev machine it is not a problem because it simply reverts back to my
credentials but on the server it reverts back to the default IIS user.
How can I work around this?
Nov 10 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: comp.lang.php | last post by:
I've heard numerous and varied commentaries here and on other fora regarding PHP and the concept of threads. Coming from a Java background I understand how threads benefit to prevent collisions,...
2
by: F. GEIGER | last post by:
In my wxPython-app a part of it gathers data, when a button is pressed, and stores it into a db. The GUI part should display the stuff being stored in the db. When both parts work on the same...
2
by: Sophia Cao | last post by:
Hello, I am seeking a python solution for my project. I am trying to implement an architecture where there is a server who receives incoming messages from several clients, then those messages...
0
by: Mike Caputo | last post by:
I'm connecting to a DB on a dual-processor 2.8 Ghz server with 2.5 gig RAM. So I've got plenty of muscle, and I'd like to do double-time on one update command. The command calls a stored procedure...
10
by: jt | last post by:
The program works like this: There is a form with a button. When the form is loaded, a separate thread is started which is retreiving/updating data in the database every x seconds. When clicked...
11
by: # Cyrille37 # | last post by:
Hello all, I come to you to getting help for managing multi threading and database connection. My project use Xml-Rpc to receive messages, so each call come from a different thread. Incoming...
3
by: arun.hallan | last post by:
I've read up on threading but it's confusing me somewhat. The functionality i need is as so: I have my main method which calls two other methods in two different classes. Each of these...
1
by: Philip Zigoris | last post by:
Hi all, I have written a socket based service in python and under fairly heavy traffic it performs really well. But i have encountered the following problem: when the system runs out of file...
1
by: Robert.R.Emmel | last post by:
Hello, I am using the threading module and the Queue module in python to to send out shipment tracking URL requests. Is there a way to timeout a thread within a Queue? I think the way I...
1
by: Pradip | last post by:
Hello every body. I am new to this forum and also in Python. Read many things about multi threading in python. But still having problem. I am using Django Framework with Python having PostgreSQL...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.