tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnny Kewl" <j...@kewlstuff.co.za>
Subject Re: Trying to mix db connection pooling on web and desktop applications
Date Wed, 23 Jul 2008 07:00:16 GMT

Out of luck ;)
Dont think it can be done... I think JNDI has a problem serving dB 
connection pools outside of a container... it needs the classloaders, common 
JVM etc etc.
I imagine one could make a RMI type provider... but a direct connection to 
the dB via JDBC is probably always going to be better.
ie outside of the container... JNDI is very much DNS/LDAP etc... because 
they just tcp/ip derivatives, not a recordset on a wire...

Maybe other solutions...

Find your own dB Pool... there are some good ones out there...
You place the biz logic and pool in the JRE EXT extension classloader 
folder...
Your servlet uses it thru the INIT method...
Your app can see it... IF its on the same JRE.... (see, thats why JNDI/JDBC 
becomes an issue outside of the same process...)

Then EJB is an option.... biz logic on app server ...  ok dont have a heart 
attack ;)

If its just a dB connection.... what about an old fashioned JDBC connection 
from the app... a single app probably doesnt need a connection pool...
      // Load the database driver
      Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" ) ;

      // Get a connection to the database
      Connection conn = DriverManager.getConnection( "jdbc:odbc:Database" ) 
;

Unless of course that biz logic is holding state... in which case its more 
than just a dB pool, you trying to share the biz logic... thats more EJB 
like...

For this I would just use the POJO Application server (runs on TC)... thats 
different again...
There you put your biz logic in the PAS and let both Tomcat and the external 
app use it... its a brand new type of technology (yours truely)
Or you put the whole app in the server and it jumps out of browsers... a 
long story

..... a good old fashioned JDBC connection from the application.... probably 
the easiest.

I dont think JNDI can do it.... ie it cant suck up a recordset thats going 
to work on the wire, not without RMI and a whole lot of other stuff 
happening ;)
Generic problem is that one cant even assume the application and tomcat are 
even on the same JRE... same machine is not enuf.

Just dont start sharing classes in tomcat libs on the general classpath to 
try make this work... that will really screw TC up
Good luck... nice question... almost the kind of thing one expects to 
work... at first anyway...

===========================
----- Original Message ----- 
From: "Alejandro Hernandez Angeles" <ahernandez@mapfre-soctec.com.mx>
To: <users@tomcat.apache.org>
Sent: Tuesday, July 22, 2008 9:51 PM
Subject: Trying to mix db connection pooling on web and desktop applications


Hello, this is the scenario:
I have an application that must have two interfaces: as a desktop 
application and as a web application
I've put the business logic inside a JAR library (client_bpm.jar), which 
must connect to an Oracle 9i database
I configured the web application so it can use a db pool connection, in the 
following manner:

And the web application runs fine, i have no problems with it
Now, what i want is to use the same db connection pool facility (that Tomcat 
provides to web applications) on my desktop application, and use the same 
code (or something very similar) i used in point 6 to obtain a db connection
With points 1-3 Tomcat provided my web application with a db connection 
pooling facility
I want Tomcat to provide to my desktop application the same db connection 
pooling facility, ┬┐How do i do that?
I have tried invoking my desktop application with the following:
java -classpath 
".;%CATALINA_HOME%/webapps/myWebApp/WEB-INF/lib/client_bpm.jar;%CATALINA_HOME%/lib/catalina.jar;%CATALINA_HOME%/bin/tomcat-juli.jar;%CATALINA_HOME%/lib/ojdbc14.jar"

 -Djava.naming.factory.initial=org.apache.naming.java.javaURLContextFactory  
-Djava.naming.factory.url.pkgs=org.apache.naming MyDesktopApp

Any suggestions will be appreciated
---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
--------------------------------------------------------------------------- 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message