473,396 Members | 2,059 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,396 software developers and data experts.

Single instance???

Hi guys

I have facing a small problem, it's like this.

There is a web service which has a web method call OpenPublicConnection
which will open a connection to the SQL Server, and there is a web method
call StartTransaction to start a tranaction for the class level connection
which is opened by the OpenPublicConection Method. But when I call
StartTransaction it's retruing an error saing the connection is closed... ?
Is there anyway to fix this?? is there anyway to keep the conneciton object
alive in the server side till client call the StartTransaction Method after
calling the OpenPublicConnection method...?

Thanks for your help
-Aruna
Nov 23 '05 #1
4 1446
One way is you can utilise ASP.Net Session state framework to achieve
this. or you can create a singleton remoting object on the server.

regards
erymuzuan mustapa

Sniper wrote:
Hi guys

I have facing a small problem, it's like this.

There is a web service which has a web method call OpenPublicConnection
which will open a connection to the SQL Server, and there is a web method
call StartTransaction to start a tranaction for the class level connection
which is opened by the OpenPublicConection Method. But when I call
StartTransaction it's retruing an error saing the connection is closed... ?
Is there anyway to fix this?? is there anyway to keep the conneciton object
alive in the server side till client call the StartTransaction Method after
calling the OpenPublicConnection method...?

Thanks for your help
-Aruna

Nov 23 '05 #2
erymuzuan wrote:
One way is you can utilise ASP.Net Session state framework to achieve
this. or you can create a singleton remoting object on the server.

regards
erymuzuan mustapa

Sniper wrote:
Hi guys

I have facing a small problem, it's like this.
There is a web service which has a web method call
OpenPublicConnection which will open a connection to the SQL Server,
and there is a web method call StartTransaction to start a tranaction
for the class level connection which is opened by the
OpenPublicConection Method. But when I call StartTransaction it's
retruing an error saing the connection is closed... ? Is there anyway
to fix this?? is there anyway to keep the conneciton object alive in
the server side till client call the StartTransaction Method after
calling the OpenPublicConnection method...?

Thanks for your help
-Aruna


You could try to solve this problem, but I think the problem is in your
web service design. You should not leave open database
connections/transactions between web service calls - this is very
inefficient and can cause many problems when clients will be making
concurrent calls to your web service.
Better think how to make your web service stateless.

Best regards
Rafal Gwizdala
Nov 23 '05 #3
Aruna,
There is a way to use transactions in a web service. Since it is stateless,
you must keep track of the user who made the request. You may want to have a
collection of "ActiveUsers" which is going to have as part of its fields
userId and connection. Whenever you start a transaction you can return a
unique Id. You must provide that Id whenever you make another request to the
web service (Update, Insert, Delete). The web service is going to loop throw
the collection and find the user with the specified Id. Once the user is
found, you can grab the connection and pass it to the Update, Insert or
Delete methods so that the connection doesnt get closed.
Then you can call the Comit or Rollback.

Gilberto

connections/transactions between web service calls - this is very
inefficient and can cause many problems when clients will be making
concurrent calls to your web service.
Better think how to make your web service stateless.
"Rafal Gwizdala" wrote:
erymuzuan wrote:
One way is you can utilise ASP.Net Session state framework to achieve
this. or you can create a singleton remoting object on the server.

regards
erymuzuan mustapa

Sniper wrote:
Hi guys

I have facing a small problem, it's like this.
There is a web service which has a web method call
OpenPublicConnection which will open a connection to the SQL Server,
and there is a web method call StartTransaction to start a tranaction
for the class level connection which is opened by the
OpenPublicConection Method. But when I call StartTransaction it's
retruing an error saing the connection is closed... ? Is there anyway
to fix this?? is there anyway to keep the conneciton object alive in
the server side till client call the StartTransaction Method after
calling the OpenPublicConnection method...?

Thanks for your help
-Aruna


You could try to solve this problem, but I think the problem is in your
web service design. You should not leave open database
connections/transactions between web service calls - this is very
inefficient and can cause many problems when clients will be making
concurrent calls to your web service.
Better think how to make your web service stateless.

Best regards
Rafal Gwizdala

Nov 23 '05 #4
Aruna,
There is a way to use transactions in a web service. Since it is stateless,
you must keep track of the user who made the request. You may want to have a
collection of "ActiveUsers" which is going to have as part of its fields
userId and connection. Whenever you start a transaction you can return a
unique Id. You must provide that Id whenever you make another request to the
web service (Update, Insert, Delete). The web service is going to loop throw
the collection and find the user with the specified Id. Once the user is
found, you can grab the connection and pass it to the Update, Insert or
Delete methods so that the connection doesnt get closed.
Then you can call the Comit or Rollback.

Gilberto

connections/transactions between web service calls - this is very
inefficient and can cause many problems when clients will be making
concurrent calls to your web service.
Better think how to make your web service stateless.
"Rafal Gwizdala" wrote:
erymuzuan wrote:
One way is you can utilise ASP.Net Session state framework to achieve
this. or you can create a singleton remoting object on the server.

regards
erymuzuan mustapa

Sniper wrote:
Hi guys

I have facing a small problem, it's like this.
There is a web service which has a web method call
OpenPublicConnection which will open a connection to the SQL Server,
and there is a web method call StartTransaction to start a tranaction
for the class level connection which is opened by the
OpenPublicConection Method. But when I call StartTransaction it's
retruing an error saing the connection is closed... ? Is there anyway
to fix this?? is there anyway to keep the conneciton object alive in
the server side till client call the StartTransaction Method after
calling the OpenPublicConnection method...?

Thanks for your help
-Aruna


You could try to solve this problem, but I think the problem is in your
web service design. You should not leave open database
connections/transactions between web service calls - this is very
inefficient and can cause many problems when clients will be making
concurrent calls to your web service.
Better think how to make your web service stateless.

Best regards
Rafal Gwizdala

Nov 23 '05 #5

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

Similar topics

16
by: Elad | last post by:
Hi, I have an application that is made up of several executables. I need all these executables to use the same instance of an object. What is the best, most efficient way to approach this? ...
18
by: Steve Barnett | last post by:
I want to ensure that there is only ever one instance of my app running on a single PC at any time. I understand that I can achieve this by using a mutex and, if I can't take ownership of the...
7
by: jsale | last post by:
I have made an ASP.NET web application that connects to SQL Server, reading and writing data using classes. I was recommended to use session objects to store the data per user, because each user...
1
by: Maileen | last post by:
Hi, How can i do (and test) a single instance of my form ? thanks, Maileen
9
by: MrSpock | last post by:
1. Create a new Windows Application project. 2. Open the project properties and check "Make single instance application". 3. Build. 4. Go to the release folder and run the application. 5. Try to...
3
by: sadanjan | last post by:
Hi , Appreciate if someone can clarify if database Share Memory Limit (2 GB ) in Unix 32 bit boxes is the top limit for all the databases put together in a database or is it for each of the...
3
by: Mark Jerde | last post by:
VS 2005. When I google "CSharp single instance form" the returned pages usually use a Mutex or the VB.NET runtime library....
13
by: JohnQ | last post by:
Why would anyone write: class SomeThing // class littered with non-domain single-instancing code :( { private: SomeThing(); static SomeThing* pInstance_; public: static SomeThing*...
3
by: sklett | last post by:
I suspect the answer might be in one of the words of my subject, but here goes anyway. I'm working on a system that will execute a very long (300+) chain of task objects. Here is some quick...
5
by: Sarath | last post by:
I've to write a single instance class. there are different methods to control the single instance of a program. I've tried the following method class CSingleton { public: CSingleton&...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...

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.