Using a connection opened by another application.

  • Thread starter Thread starter ajitgoel
  • Start date Start date
A

ajitgoel

Hi Everyone;

I have a application (application 1) which is connected to a sybase
database. I have another application (application 2) which will be
issuing sql commands on the same database. However when I try to open a
connection against the same database, I get the error "Request to
Start/Stop Database denied.".

What I want to do is:

a) create and use a database connection, if the database is not
started(either by application 1 or application 2).
b) use the created database connection, if the database is
started(either by application 1 or application 2).

Pointers to how to go about doing this are welcome.
Kind Regards;
Ajit Goel
 
Some code may help to understand.

For me :
- the database should be always "started"
- each application should use its own ADO.NET connection (are you talking
about some other kind of connection).

For now it looks rather like somthing that is Sybase specific rather than an
ADO.NET problem ? Could it be also something laike the database being in
single connection mode ?

Patrice
 
I feel you should leave connection pooling to the ADO.NET libraries. Even if
you were to acheive the below, all you'd be sharing would be the connection
object, the actual underlying connection will still be pooled.

If you must insist on the below, then you'll have to involve remoting.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
 
We have established that this is a Sybase rig which works very much like SQL
Server.
Like SQL Server, Sybase databases can be "stopped" and "started" and might
be in the "stop" or "pause" mode when you try to connect. While I don't know
what interfaces Sybase supports, I do know that SQL DMO can start/stop the
server as can calls to Windows Services APIs. In some cases, it makes sense
to stop the server when the last application that needs it shuts down. In
this case, your code needs to figure out the conundrum: how do you know if
another application is loaded that intends to use the server (but might not
have a connection open). In a simple configuration, you can leave the server
running (and consuming resources) waiting for an application to use it.
However, this often makes users buy more RAM and faster systems to
compensate--an expensive solution to a problem that can be solved with a bit
of code (albeit complex).

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top