CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 How to get a 'custom connection' in JSP 1.1 + Templates

Print topic Send  topic

Author Message
David A. Lee
Posted: 11/01/2002, 6:41 PM

I'm trying to use a Session variable to specify the database/connection in
JSP1.1 + Templates with no luck.
The 'Use Custom Connection' seems broken, it doesnt rewrite the code in
Common.jsp which makes
explicit use of

Connection cn() { ... }

Plus it doesnt really let me use a 'custom connection' it just sorta messes
up the code.
So I've instead tried to use a "Custom Common" and just rewrite the
existing loadDriver() and cn() functions.
This works well enough for globally changing the connection. My goal is
that in a per-session way,
I want to redefine the database connection string. ( I have an addition to
the Login page which lets
the user specify which host+db to connect to).
This works fine if I store a static variable containing the connection
string inside a java code which
is loaded in the app server (Tomcat 4.0) .. it persists from call to call
and I can access it via the Common.jsp code.

The problem is that I want this to be per-session variable. That is, 2
concurrent sessions should be able
to use different databases without interfering. I tried using the Session
attribute, but the problem is that
the "cn()" function takes no arguments, and at this scope there is no
pointer to the HttpSession object
so I cant get a session attribute !!! I can rewrite the cn() call to take a
session argument, but then I need
to manually rewrite all the calling JSP code. Furthermore, there are other
functions in Common.jsp which
do not take session arguments which call cn() directly (such as dLookUp()).

Has anyone any suggestions for getting at a session variable/attribute
without a direct HttpSession object ?
Or any way to store this in such a way that different sessions dont
interfere ?

Thanks !


----------------------------------------------------------------
David A. Lee
President, DAL Enterprises Inc.
dave@calldei.com http://www.calldei.com

David A. Lee
Posted: 11/13/2002, 6:35 AM

FYI: This has now been fixed by Helen at CodeCharge !
Thanks !!! If you have a similar problem I'm sure CC support will send you
the fix.
If not let me know and I'll send it to you.
Maybe they will publish a public patch (hint hint ?)

-David

dave@calldei.com



> I'm trying to use a Session variable to specify the database/connection in
> JSP1.1 + Templates with no luck.
> The 'Use Custom Connection' seems broken, it doesnt rewrite the code in
> Common.jsp which makes
> explicit use of
>
> Connection cn() { ... }
>
> Plus it doesnt really let me use a 'custom connection' it just sorta
messes
> up the code.
> So I've instead tried to use a "Custom Common" and just rewrite the
> existing loadDriver() and cn() functions.
> This works well enough for globally changing the connection. My goal is
> that in a per-session way,
> I want to redefine the database connection string. ( I have an addition
to
> the Login page which lets
> the user specify which host+db to connect to).
> This works fine if I store a static variable containing the connection
> string inside a java code which
> is loaded in the app server (Tomcat 4.0) .. it persists from call to call
> and I can access it via the Common.jsp code.
>
> The problem is that I want this to be per-session variable. That is, 2
> concurrent sessions should be able
> to use different databases without interfering. I tried using the Session
> attribute, but the problem is that
> the "cn()" function takes no arguments, and at this scope there is no
> pointer to the HttpSession object
> so I cant get a session attribute !!! I can rewrite the cn() call to take
a
> session argument, but then I need
> to manually rewrite all the calling JSP code. Furthermore, there are
other
> functions in Common.jsp which
> do not take session arguments which call cn() directly (such as
dLookUp()).
>
> Has anyone any suggestions for getting at a session variable/attribute
> without a direct HttpSession object ?
> Or any way to store this in such a way that different sessions dont
> interfere ?
>
> Thanks !
>
>
> ----------------------------------------------------------------
> David A. Lee
> President, DAL Enterprises Inc.
>dave@calldei.com http://www.calldei.com
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.