Passing db connection info from one instance to another in Netscape NSAPI 
Author Message
 Passing db connection info from one instance to another in Netscape NSAPI

For anyone that is working on the NSAPI:

I am building a database application into the NSAPI.  I have the forms
returning information to my application function.  The application
function is opening a database connection, and returning information to
the client.  The only problem is that I am opening and closing my
connection each time I run the function.  Can anyone tell me how I can
make the connection global so that each instance of my application
function can see the connection?  In other words, how can I make a
variable global to each instance of my application function.  If this is
the wrong forum for this, please send suggestions of other forums.



Mon, 23 Nov 1998 03:00:00 GMT
 Passing db connection info from one instance to another in Netscape NSAPI

: For anyone that is working on the NSAPI:
:
: I am building a database application into the NSAPI.  I have the forms
: returning information to my application function.  The application
: function is opening a database connection, and returning information to
: the client.  The only problem is that I am opening and closing my
: connection each time I run the function.  Can anyone tell me how I can
: make the connection global so that each instance of my application
: function can see the connection?  In other words, how can I make a
: variable global to each instance of my application function.  If this is
: the wrong forum for this, please send suggestions of other forums.

1. You might try comp.infosystems.www.authoring.cgi, which I've
added to the headers.

2. I doubt your problem can be solved at all; the problem is not
the database but the inherent statelessness of the http protocols.
With Sybase web.sql using the NSAPI, you can have it cache database
connections, meaning that each server demon process can keep several
connections open, so the connection-opening overhead is not any
longer a performance issue.  However, what you cannot do with an
inherently-stateless server is control WHICH cached database
connection gets the next hit from a given client.  If, say, the
server has seven connections open, there is only one chance
out of seven that you'll get that one the next time you connect.

This is not a limitation of your database or your WWW server, it
is an inherent limitation in the design of http.

One answer people sometimes use is to keep a table of client-specific
information around.  Then, however, you have some very messy problems:

   o there is no built-in unique ID in http; the IP address may be
     shared by multiple users, either on a multi-user system or
     behind a proxy

   o You can generate an URL containing a random number the first time
     a client connects, then pass that back and forth.  However, when
     do you remove old state?  There is no concept of a session in
     http, hence no way to log in or log out, hence you have to go
     by heuristics such as removing all client history records older
     than X minutes where you pick X...

The usual workaround is to keep the state information on the client side,
by one of several methods -- Netscape Cookies, hidden form fields, or
URL rewriting.

People are working on solutions, possibly involving JAVA, possibly
involving some kind of keep-alive parameter that makes client and
server bounce packets at regular intervals, but for now we all must
live with a stateless server.

--------

Center for Medical Informatics, Yale School of Medicine
Real Programmers eat Perl barley (or else prefer Raw Bits)
http://paella.med.yale.edu/~healy/matt_healy.html



Tue, 24 Nov 1998 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Passing db connection info from one instance to another in Netscape NSAPI

2. Database connections built into the NSAPI of the Netscape Commerce Server

3. Problem using sybase with nsapi (netscape server)

4. Sybase ct-lib and Netscape NSAPI

5. Need Info on how to put MsAccess DB on WEB and srch w/ only Netscape Browser

6. Moving unix DB instance to NT DB instance

7. JDBC connection URL for multiple instances of SQL Server on one machine

8. ò?: Multiple instances on one DB

9. Multiple instances on one DB

10. 2 db instances on 1 NT server can't connect to one from client

11. install new instance of MSDE over a named instance one


 
Powered by phpBB® Forum Software