No subject


Thu Mar 18 00:20:18 PST 2004


1. keep the jsp's for the most part as they are and replace your java =
code portions (your code snippet) in each jsp with the necessary JNDI =
modifications. In this approach I'd guess you'd get it work in one page =
and then mostly copy-paste-tweak the equivalent code snippet in each =
other jsp   (I've put a modified top portion of your code snippet at the =
bottom of this reply.)
2. write a simple bean which is able to give you a connection to your =
database. For example the bean would have a single method :
                                Connection getConnection();
    This is a variation on option 1. since you'd still have the java =
code snippets In each jsp but they would no longer have the code =
necessary to get a Connection, you'd replace that by a call to =
connectionBean.getConnection(). The rest of your code snippet would be =
the same.
3. migrate your jsp's to use tag libraries. For example you could use a =
custom tag to execute your queries, pull the data out of the ResultSet's =
and make that available for display. This would greatly reduce the =
amount of java code in your jsp's but takes more work.  =20

Since your primary motivation is to migrate the existing app to the new =
app server and utilize the connection pooling, I'd think option 1 or 2  =
.  I'd lean for option 2 since you'd only have to get the connection =
code right in one place (the bean) and you'd have to change all jsp's =
anyway.  But as always depends on your circumstances/timeline etc. (I =
know what it's like:-) =20

Your question about JNDI controlling connection pooling.  No, JNDI does =
not control connection pooling.   An app server like Oracle will provide =
it's own implemenation of JNDI, which is a naming and directory =
interface. So in your case Oracle app server provides a naming/directory =
service.  Such a service is used for centrally registering services that =
you want to be shared by multiple clients. So each client (the jsp's or =
the bean in your case) uses JNDI purely for lookup purposes, in the =
context of what you are trying to do they lookup a data source.  JNDI =
doesn't care what objects you put into the service. For example EJB's =
are accessed this way.  So all JNDI knows is that objects can be put =
into it and taken out of it based on a unique name (just like the =
Windows registry.)    In the case of a connection pool, the application =
server at startup will create and register all it's objects which need =
to be registered in the JNDI service.  For each connection pool that has =
been configured it will register it under the assigned name.   The =
connection pool is represented by a "DataSource" object. It is the the =
DataSource object which is responsible for managing the connection pool. =
 =20

I hope I am not being too abstract in answering.  Let me know if more =
details on specific things would help further.   We can communicate =
further.  During work days it's best if you can include my email =
mailto:Paul.Devine at AmbientConsulting.com in the reply, i'll see it and =
respond to it faster that way.     If I don't hear back from you, best =
of luck...

Thanks
- Paul

modified code snippet:
<%
// you'll need to add the necessary packages to your import's . I can't =
remember them all off the top of my head.=20
// UipContentDB is whatever alias name the administrator assigns to the =
connection pool
String dbName =3D "java:comp/env/jdbc/UipContentDB";
InitialContext context =3D new InitialContext
DataSource ds =3D (DataSource)context.lookup( dbName );
Connection bConn  =3D ds.getConnection();

/**** Beginning of  old code=20
file://String firstconn =3D =
"jdbc:mysql://localhost/uipcontent?user=3Duipcontent&password=3D*****";
file://Class.forName("org.gjt.mm.mysql.Driver");

// create connection string

// pass database parameters to JDBC driver
Connection bConn =3D DriverManager.getConnection(firstconn);
 end of old code  ***/

//.... etc  the rest of the code is exactly the same

%>
  ----- Original Message -----=20
  From: Mark Stringham=20
  To: opensource at javacorporate.com=20
  Cc: devine_paul at hotmail.com=20
  Sent: Friday, January 18, 2002 1:31 PM
  Subject: Re: [Opensource] Using JNDI for database connectivity


  Paul -
  I sincerely appreciate you taking time to explan this - you have been =
a tremendous help but because I am still very new to JSP I will need a =
little more assistance. I apologize in advance for lame questions.

  My problem is this : In many of my JSP's I am using JDBC to connect to =
a db (better practice would've been to put the connection in a bean but =
I did it this way for development purposes)=20

  Here is a code snippet:
  <%
  String firstconn =3D =
"jdbc:mysql://localhost/uipcontent?user=3Duipcontent&password=3D*****";
  Class.forName("org.gjt.mm.mysql.Driver");

  // create connection string

  // pass database parameters to JDBC driver
  Connection bConn =3D DriverManager.getConnection(firstconn);

  // query statements
  String getrows =3D "SELECT * FROM sections_test WHERE =
page_section=3D'About UIP' AND page_name=3D'Main Page'";

  // PREPARED STATEMENTS AND EXECUTION
  PreparedStatement find =3D bConn.prepareStatement(getrows);
  ResultSet RS =3D find.executeQuery();
  while(RS.next())
  {
   pageheadline =3D RS.getString("page_headline");
   pagecontent =3D RS.getString("page_content");
   pageimage =3D RS.getString("page_image");
   }
  RS.close();
  bConn.close();
  %>

  My question here is - do I replace this connection syntax with the =
JNDI syntax that you explained?
  Is it something I will need to replace on every JSP page that I am =
using a JDBC connection? or is it something that can be done once and =
then use the get connection( ) and close connection( ).

  Does JNDI control the connection pooling?

  I can get the data source name and the db name - no problem - I'd just =
like to know how to use this.
  I have had little help from the IT folks where I need to move this =
application so your email has been so very helpful.

  And thank you for the reference to the Java docs and J2ee information.

  Thanks again Paul - I'm looking forward to getting this app to work.

  Mark=20

    -----Original Message-----
    From: Paul Devine <devine_paul at hotmail.com>
    To: opensource at javacorporate.com <opensource at javacorporate.com>
    Date: Friday, January 18, 2002 11:43 AM
    Subject: Re: [Opensource] Using JNDI for database connectivity


    Mark

    you will not have to change as much as you might fear.  The basic =
difference comes in how you acquire a Connection.  Once you have a =
Connection the rest of your code will be the same jdbc code.      You =
will use JNDI to do a `DataSource` lookup.  The DataSource can give you =
a Connection from the pool of Connections it manages (the DataSource =
will actually be an object implementing the  ConnectionPoolDataSource =
interface but you don't have to worry about it, those details are taken =
care of for you by the app server.)   What you will need is a name =
(String) for the lookup in JNDI.  This name is specified when =
configuring the DataSource in the app server itself, i.e. it's a =
configuration item.=20

    Your syntax will be something like :

    // (MyDB is the name under which you registered the pool in the app =
server configuration)

    String dbName =3D "java:comp/env/jdbc/MyDB";=20

    InitialContext context =3D new InitialContext();

    DataSource ds =3D (DataSource)context.lookup( dbName )

    Connection conn =3D dataSource.getConnection();

    ... do whatever you need with the connection ...

    conn.close() ; // releases back to the pool



    I know this is high level.  If you want more programming level =
details I'd recommend java.sun.com/j2ee->Java Tutorial to get a start.   =
There are also some best practices you'll want to consider for your =
migration involving JNDI. Since a JNDI lookup can be expensive you may =
consider avoiding repetitive lookups of the DataSource. This is covered =
in the pattern named "Service Locator" under the J2EE Patterns at =
java.sun.com/j2ee. =20

    Just let me know if you need more information on any of this.

    Thanks

    - Paul


    >From: "Mark Stringham"=20
    >Reply-To: opensource at javacorporate.com=20
    >To:=20
    >Subject: [Opensource] Using JNDI for database connectivity=20
    >Date: Thu, 17 Jan 2002 13:17:49 -0700=20
    >=20
    >This is not an expresso related question but wondered what folks =
might have=20
    >to say.=20
    >I created a JSP app and used JRUN 3.0 as my container and MySQL as =
the DB. I=20
    >have to migrate this app to Oracle 9 using iplanet 6.0 as the =
application=20
    >server. I also found out that I have to change all my JDBC =
connections to=20
    >JNDI because it uses connection pooling more efficiently. Because I =
have=20
    >never used anything but JDBC connectivity I am cluless as to how =
implement=20
    >JNDI connectivity. What does the syntax look like?=20
    >=20
    >I thought I could replace my JDBC connection variables with JNDI =
syntax but=20
    >evidently this is not the case.=20
    >Any ideas?=20
    >=20
    >thanks=20
    >Mark=20
    >=20
    >=20
    >=20
    >=20
    >-----Original Message-----=20
    >From: TimothyReaves at westfieldgrp.com=20
    >To: opensource at javacorporate.com=20
    >Date: Thursday, January 17, 2002 12:53 PM=20
    >Subject: [Opensource] Complete install question=20
    >=20
    >=20
    > > The complete install has Tomcat running on port 8080. When I go =
to=20
    > >the setup values page, the Port Number for Servlet Server is set =
to 80.=20
    > >Shouldn't this also be 8080?=20
    > >=20
    > >=20
    > >=20
    > >_______________________________________________=20
    > >Opensource mailing list=20
    > >Opensource at javacorporate.com=20
    > >http://www.javacorporate.com/mailman/listinfo/opensource=20
    > >=20
    >=20
    >=20
    >=20
    >_______________________________________________=20
    >Opensource mailing list=20
    >Opensource at javacorporate.com=20
    >http://www.javacorporate.com/mailman/listinfo/opensource=20


-------------------------------------------------------------------------=
---
    Get your FREE download of MSN Explorer at http://explorer.msn.com.
    _______________________________________________ Opensource mailing =
list Opensource at javacorporate.com =
http://www.javacorporate.com/mailman/listinfo/opensource=20

------=_NextPart_000_0034_01C1A05A.AA701EE0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3315.2870" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Mark</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>(firstly, you are welcome, and there's =
no need to=20
apologize for questions, they are all good :-)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>From what I see you have some different =

options:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>1. keep the jsp's for the most part as =
they are and=20
replace your java code portions (your code snippet) in each jsp with the =

necessary JNDI modifications. In this approach I'd guess you'd get it =
work in=20
one page and then mostly copy-paste-tweak the equivalent code snippet in =
each=20
other jsp&nbsp;&nbsp; (I've put a modified top portion of your code =
snippet at=20
the bottom of this reply.)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>2. write a simple bean which is able to =
give you a=20
connection to your database. For example the bean would have a single =
method=20
:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
Connection getConnection();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; This is a variation =
on option 1.=20
since you'd still have the java code snippets In each jsp but they would =
no=20
longer have the code necessary to get a Connection, you'd replace that =
by a call=20
to connectionBean.getConnection(). The rest of your code snippet would =
be the=20
same.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>3. migrate your jsp's to use tag =
libraries. For=20
example you could use a custom tag to execute your queries, pull the =
data out of=20
the ResultSet's and make that available for display. This would greatly =
reduce=20
the amount of java code in your jsp's but takes more work.&nbsp;&nbsp;=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Since your primary motivation is to =
migrate the=20
existing app to the new app server and utilize the connection pooling, =
I'd think=20
option 1 or 2&nbsp; .&nbsp; I'd lean for option 2 since you'd only have =
to get=20
the connection code right in one place (the bean) and&nbsp;you'd have to =
change=20
all jsp's anyway.&nbsp; But as always depends on your =
circumstances/timeline=20
etc. (I know what it's like:-)&nbsp;&nbsp;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Your question about JNDI controlling =
connection=20
pooling.&nbsp; No, JNDI does not control connection pooling.&nbsp;&nbsp; =
An app=20
server like Oracle will provide it's own implemenation of JNDI, which is =
a=20
naming and directory interface. So in your case Oracle app server =
provides a=20
naming/directory service.&nbsp; Such a service is used for centrally =
registering=20
services that you want to be shared by multiple clients. So each client =
(the=20
jsp's or the bean in your case) uses JNDI purely for lookup purposes, in =
the=20
context of what you are trying to do they lookup a data source.&nbsp; =
JNDI=20
doesn't care what objects you put into the service. For example EJB's =
are=20
accessed this way.&nbsp; So all JNDI knows is that objects can be put =
into it=20
and taken out of it based on a unique name (just like the Windows=20
registry.)&nbsp;&nbsp;&nbsp; In the case of a connection pool, the =
application=20
server at startup will create and register all it's objects which need =
to be=20
registered in the JNDI service.&nbsp; For each connection pool that has =
been=20
configured it will register it under the assigned name.&nbsp;&nbsp; The=20
connection pool is represented by a "DataSource" object. It is the the=20
DataSource object which is responsible for managing the connection=20
pool.&nbsp;&nbsp; </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I hope I am not being too abstract in=20
answering.&nbsp; Let me know if more details on specific things would =
help=20
further.&nbsp;&nbsp; We can communicate further.&nbsp; During work days =
it's=20
best if you can include my email <A=20
href=3D"mailto:Paul.Devine at AmbientConsulting.com">mailto:Paul.Devine at Ambi=
entConsulting.com</A>=20
in the reply, i'll see it and respond to it faster that=20
way.&nbsp;&nbsp;&nbsp;&nbsp; If I don't hear back from you, best of=20
luck...</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>- Pau</FONT><FONT face=3DArial =
size=3D2>l</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>modified code snippet:
<DIV><FONT size=3D1>&lt;%</FONT></DIV>
<DIV><FONT size=3D1>// you'll need to add the necessary packages to your =
import's=20
. I can't remember them all off the top of my head. </FONT></DIV>
<DIV><FONT size=3D1>// UipContentDB is whatever alias name the =
administrator=20
assigns to the connection pool</FONT></DIV>
<DIV><FONT size=3D1>String dbName =3D=20
"java:comp/env/jdbc/UipContentDB";</FONT></DIV>
<DIV><FONT size=3D1>InitialContext context =3D new =
InitialContext</FONT></DIV>
<DIV><FONT size=3D1>DataSource ds =3D (DataSource)context.lookup( dbName =

);</FONT></DIV>
<DIV>Connection bConn&nbsp; =3D ds.getConnection();</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D1><A href=3D"file://String"><FONT =
size=3D2>/*</FONT></A>***=20
Beginning of  old code </FONT></DIV>
<DIV><FONT size=3D1><A href=3D"file://String">file://String</A> =
firstconn =3D=20
"jdbc:mysql://localhost/uipcontent?user=3Duipcontent&amp;password=3D*****=
";<BR><A=20
href=3D"file://Class.forName">file://Class.forName</A>("org.gjt.mm.mysql.=
Driver");</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D1>// create connection string</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D1>// pass database parameters to JDBC =
driver<BR>Connection bConn=20
=3D DriverManager.getConnection(firstconn);</FONT></DIV></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;end of old code&nbsp; =
***/</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV>//.... etc&nbsp; the rest of the code is exactly the same</DIV>
<DIV>&nbsp;</DIV>
<DIV>%&gt;</DIV></FONT></DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A href=3D"mailto:mstringham at edeasolutions.com"=20
  title=3Dmstringham at edeasolutions.com>Mark Stringham</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A=20
  href=3D"mailto:opensource at javacorporate.com"=20
  title=3Dopensource at javacorporate.com>opensource at javacorporate.com</A> =
</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Cc:</B> <A=20
  href=3D"mailto:devine_paul at hotmail.com"=20
  title=3Ddevine_paul at hotmail.com>devine_paul at hotmail.com</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Friday, January 18, 2002 =
1:31=20
  PM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: [Opensource] Using =
JNDI for=20
  database connectivity</DIV>
  <DIV><BR></DIV>
  <DIV><FONT size=3D2>Paul -</FONT></DIV>
  <DIV><FONT size=3D2>I sincerely appreciate you taking time to explan =
this - you=20
  have been a tremendous help but because I am still very new to JSP I =
will need=20
  a little more assistance. I apologize in advance for lame=20
  questions.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT size=3D2>My problem is this : In many of my JSP's I am =
using JDBC to=20
  connect to a db (better practice would've been to put the connection =
in a bean=20
  but I did it this way for development purposes) </FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT size=3D2>Here is a code snippet:</FONT></DIV>
  <DIV><FONT size=3D1>&lt;%</FONT></DIV>
  <DIV><FONT size=3D1>String firstconn =3D=20
  =
"jdbc:mysql://localhost/uipcontent?user=3Duipcontent&amp;password=3D*****=
";<BR>Class.forName("org.gjt.mm.mysql.Driver");</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT size=3D1>// create connection string</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT size=3D1>// pass database parameters to JDBC =
driver<BR>Connection=20
  bConn =3D DriverManager.getConnection(firstconn);</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT size=3D1>// query statements<BR>String getrows =3D "SELECT =
* FROM=20
  sections_test WHERE page_section=3D'About UIP' AND page_name=3D'Main=20
  Page'";</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT size=3D1>// PREPARED STATEMENTS AND =
EXECUTION<BR>PreparedStatement=20
  find =3D bConn.prepareStatement(getrows);<BR>ResultSet RS =3D=20
  find.executeQuery();<BR>while(RS.next())<BR>{<BR>&nbsp;pageheadline =
=3D=20
  RS.getString("page_headline");<BR>&nbsp;pagecontent =3D=20
  RS.getString("page_content");<BR>&nbsp;pageimage =3D=20
  =
RS.getString("page_image");<BR>&nbsp;}<BR>RS.close();<BR>bConn.close();<B=
R>%&gt;</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT size=3D2>My question here is - do I&nbsp;replace this =
connection=20
  syntax with&nbsp;the JNDI syntax&nbsp;that you explained?</FONT></DIV>
  <DIV><FONT size=3D2>Is it something I will need to replace on every =
JSP page=20
  that I am using a JDBC connection?&nbsp;or is it something that can be =
done=20
  once and then use the get connection( ) and close connection( =
).</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT size=3D2>Does JNDI control the connection =
pooling?</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT size=3D2>I can get the data source name and the db name - =
no problem=20
  - I'd just like to know how to use this.</FONT></DIV>
  <DIV><FONT size=3D2>I have had little help from the IT folks where I =
need to=20
  move this application so your email has been so very =
helpful.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT size=3D2>And thank you for the reference to the Java docs =
and J2ee=20
  information.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT size=3D2>Thanks again Paul - I'm looking forward to getting =
this app=20
  to work.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT size=3D2>Mark </FONT></DIV>
  <DIV>&nbsp;</DIV>
  <BLOCKQUOTE=20
  style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; =
PADDING-LEFT: 5px">
    <DIV><FONT face=3DArial size=3D2><B>-----Original =
Message-----</B><BR><B>From:=20
    </B>Paul Devine &lt;<A=20
    =
href=3D"mailto:devine_paul at hotmail.com">devine_paul at hotmail.com</A>&gt;<B=
R><B>To:=20
    </B><A=20
    =
href=3D"mailto:opensource at javacorporate.com">opensource at javacorporate.com=
</A>=20
    &lt;<A=20
    =
href=3D"mailto:opensource at javacorporate.com">opensource at javacorporate.com=
</A>&gt;<BR><B>Date:=20
    </B>Friday, January 18, 2002 11:43 AM<BR><B>Subject: </B>Re: =
[Opensource]=20
    Using JNDI for database connectivity<BR><BR></DIV></FONT>
    <DIV>
    <DIV>
    <P>Mark</P>
    <P>you will not have to change as much as you might fear.&nbsp; The =
basic=20
    difference comes in how you acquire a Connection.&nbsp; Once you =
have a=20
    Connection the rest of your code will be the same jdbc=20
    code.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; You will use JNDI to do a =
`DataSource`=20
    lookup.&nbsp; The DataSource can give you a&nbsp;Connection from the =
pool of=20
    Connections it manages (the DataSource will actually be an object=20
    implementing the &nbsp;ConnectionPoolDataSource interface but you =
don't have=20
    to worry about it, those details are taken care of for you by the =
app=20
    server.)&nbsp;&nbsp; What you will need is a name (String) for the =
lookup in=20
    JNDI.&nbsp; This name is specified when configuring the DataSource =
in the=20
    app server itself, i.e. it's a configuration item. </P>
    <P>Your syntax will be something like :</P>
    <P>// (MyDB is the name under which you registered the pool in the =
app=20
    server configuration)</P>
    <P>String dbName =3D "java:comp/env/jdbc/MyDB";<A =
name=3D63284>&nbsp;</A></P>
    <P>InitialContext context =3D new InitialContext();</P>
    <P>DataSource ds =3D (DataSource)context.lookup( dbName )</P>
    <P>Connection conn =3D dataSource.getConnection();</P>
    <P>... do whatever you need with the connection ...</P>
    <P>conn.close() ; // releases back to the pool</P>
    <P>&nbsp;</P>
    <P>I know this is high level.&nbsp; If you want more programming =
level=20
    details I'd recommend java.sun.com/j2ee-&gt;Java Tutorial to get a=20
    start.&nbsp;&nbsp;&nbsp;There are also some best practices you'll =
want to=20
    consider for your migration involving JNDI.&nbsp;Since a JNDI lookup =
can be=20
    expensive you may consider avoiding repetitive lookups of the=20
    DataSource.&nbsp;This is covered in the pattern named "Service =
Locator"=20
    under the J2EE Patterns at java.sun.com/j2ee. &nbsp;</P>
    <P>Just let me know if you need more information on any of this.</P>
    <P>Thanks</P>
    <P>- Paul<BR></P></DIV>
    <DIV></DIV>
    <DIV></DIV>&gt;From: "Mark Stringham" <MSTRINGHAM at EDEASOLUTIONS.COM>
    <DIV></DIV>&gt;Reply-To: opensource at javacorporate.com=20
    <DIV></DIV>&gt;To: <OPENSOURCE at JAVACORPORATE.COM>
    <DIV></DIV>&gt;Subject: [Opensource] Using JNDI for database =
connectivity=20
    <DIV></DIV>&gt;Date: Thu, 17 Jan 2002 13:17:49 -0700=20
    <DIV></DIV>&gt;=20
    <DIV></DIV>&gt;This is not an expresso related question but wondered =
what=20
    folks might have=20
    <DIV></DIV>&gt;to say.=20
    <DIV></DIV>&gt;I created a JSP app and used JRUN 3.0 as my container =
and=20
    MySQL as the DB. I=20
    <DIV></DIV>&gt;have to migrate this app to Oracle 9 using iplanet =
6.0 as the=20
    application=20
    <DIV></DIV>&gt;server. I also found out that I have to change all my =
JDBC=20
    connections to=20
    <DIV></DIV>&gt;JNDI because it uses connection pooling more =
efficiently.=20
    Because I have=20
    <DIV></DIV>&gt;never used anything but JDBC connectivity I am =
cluless as to=20
    how implement=20
    <DIV></DIV>&gt;JNDI connectivity. What does the syntax look like?=20
    <DIV></DIV>&gt;=20
    <DIV></DIV>&gt;I thought I could replace my JDBC connection =
variables with=20
    JNDI syntax but=20
    <DIV></DIV>&gt;evidently this is not the case.=20
    <DIV></DIV>&gt;Any ideas?=20
    <DIV></DIV>&gt;=20
    <DIV></DIV>&gt;thanks=20
    <DIV></DIV>&gt;Mark=20
    <DIV></DIV>&gt;=20
    <DIV></DIV>&gt;=20
    <DIV></DIV>&gt;=20
    <DIV></DIV>&gt;=20
    <DIV></DIV>&gt;-----Original Message-----=20
    <DIV></DIV>&gt;From: TimothyReaves at westfieldgrp.com=20
    <TIMOTHYREAVES at WESTFIELDGRP.COM>
    <DIV></DIV>&gt;To: opensource at javacorporate.com=20
    <OPENSOURCE at JAVACORPORATE.COM>
    <DIV></DIV>&gt;Date: Thursday, January 17, 2002 12:53 PM=20
    <DIV></DIV>&gt;Subject: [Opensource] Complete install question=20
    <DIV></DIV>&gt;=20
    <DIV></DIV>&gt;=20
    <DIV></DIV>&gt; &gt; The complete install has Tomcat running on port =
8080.=20
    When I go to=20
    <DIV></DIV>&gt; &gt;the setup values page, the Port Number for =
Servlet=20
    Server is set to 80.=20
    <DIV></DIV>&gt; &gt;Shouldn't this also be 8080?=20
    <DIV></DIV>&gt; &gt;=20
    <DIV></DIV>&gt; &gt;=20
    <DIV></DIV>&gt; &gt;=20
    <DIV></DIV>&gt; &gt;_______________________________________________=20
    <DIV></DIV>&gt; &gt;Opensource mailing list=20
    <DIV></DIV>&gt; &gt;Opensource at javacorporate.com=20
    <DIV></DIV>&gt; =
&gt;http://www.javacorporate.com/mailman/listinfo/opensource=20

    <DIV></DIV>&gt; &gt;=20
    <DIV></DIV>&gt;=20
    <DIV></DIV>&gt;=20
    <DIV></DIV>&gt;=20
    <DIV></DIV>&gt;_______________________________________________=20
    <DIV></DIV>&gt;Opensource mailing list=20
    <DIV></DIV>&gt;Opensource at javacorporate.com=20
    =
<DIV></DIV>&gt;http://www.javacorporate.com/mailman/listinfo/opensource=20
    <DIV></DIV></DIV><BR clear=3Dall>
    <HR>
    Get your FREE download of MSN Explorer at <A=20
    =
href=3D"http://go.msn.com/bql/hmtag_etl_EN.asp">http://explorer.msn.com</=
A>.<BR>_______________________________________________=20
    Opensource mailing list Opensource at javacorporate.com=20
    http://www.javacorporate.com/mailman/listinfo/opensource=20
</BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0034_01C1A05A.AA701EE0--





More information about the Opensource mailing list