You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by prakash shanmugam <pr...@gmail.com> on 2006/09/26 08:47:52 UTC
connection pooling in Linux using Tomcat 5.0.x and MYSQL
hai all,
can u do one help ...
i need details about how to configure Connection Pooling in
Tomcat with MySQL in Linux platform...
i have done in windows platform..its working well..
i followed the same concepts in linux server also..
but it is not working... can u u hepl me in this regard..
it will be very much helpful for me if u do this..
with regards
prakash
Re: connection pooling in Linux using Tomcat 5.0.x and MYSQL
Posted by prakash shanmugam <pr...@gmail.com>.
hai all
thank for u r care and intrest insolving the issue.
now i had one more issue to be solved before implementing the connection
pooling.
the problem is
in my project, i have few pages it will be view by more then one person
through intrenet. when one are more person trying to acuss the same page at
the same time one person is getting "OPERATION NOT ALLOWED AFTERRESULT SET
IS CLOSED" error
i had used jsp servlet and bean file in my project
here by i will send my bean file used for database connection
package com.pts.database;
import java.io.*;
import java.sql.*;
import java.net.*;
public class DBCon
{
private static final String DriverClass = "com.mysql.jdbc.Driver";
private static final String CONNECTION_STRING = "jdbc:mysql://";
private static final String PORT = "3306";
private static final String DATABASE = "opts";
private static final String user = "dav";
private static final String pwd="";
private static Connection con = null;
private static Statement stmt = null;
private static Statement stmt2 = null;
private static PreparedStatement pst = null;
private static ResultSet rs = null;
private static int count = 0;
public static void assignCon()
{
// String CONNECTION_IP="";
//try{
// InetAddress ia = InetAddress.getLocalHost();
//CONNECTION_IP=ia.getHostAddress();
String CONNECTION_IP="100.100.100.6";
//System.out.println("inside servlet DBCon file");
// System.out.println("u r database IP is "+CONNECTION_IP);
//}catch(UnknownHostException ue){System.out.println(ue);}
try{
Class.forName(DriverClass).newInstance();
}
catch(ClassNotFoundException ce){System.out.println(ce);}
catch(InstantiationException ie){}
catch(IllegalAccessException ie1){}
try
{
con = DriverManager.getConnection
(CONNECTION_STRING+CONNECTION_IP+":"+PORT+"/"+DATABASE,user,pwd);
stmt = con.createStatement();
stmt2 = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
}catch(SQLException sqle){System.out.println("STMT:"+sqle);}
}
public static ResultSet retrieveFromDB(String sql) throws SQLException
{
return (stmt.executeQuery(sql));
}
public static ResultSet retrieveScrollDB(String sql) throws SQLException
{
return (stmt2.executeQuery(sql));
}
public static int updateDB(String sql) throws SQLException
{
return (stmt.executeUpdate(sql));
}
public static PreparedStatement prepareStmt(String sql) throws
SQLException{
pst=con.prepareStatement(sql);
return pst;
}
public static ResultSet getProjectsList() throws SQLException{
rs=((PreparedStatement)con.prepareStatement("select projID,projName from
proj_det where delFlag=0 || delFlag IS NULL")).executeQuery();
return rs;
// public staic ResultSet getProjectList() Throws
}
public static Connection getConn() {
return con;
}
public static Statement getStmt()
{
return stmt;
}
public static void closeAll() throws SQLException
{
rs.close();
stmt.close();
stmt2.close();
con.close();
}
}
tellme where to change the code
my database is mysql 4.0
driver is com.mysql.jdbc.Driver
server is Tomcat5.0
with regards
prakash
On 9/27/06, David Smith <dn...@cornell.edu> wrote:
>
> On JNDI connection problems: We'll need to see more. Specifically the
> jsp code calling for the sql connection and the web.xml. A full stack
> trace of the error you get would be excellent as well. Lastly, confirm
> the mysql jdbc driver is in common/lib of the tomcat directory, not
> WEB-INF/lib of your webapp.
>
> On configuring in server.xml, this is fast becoming a file that should
> be left alone for all but general server configuration. JNDI resources
> should be defined either in your [webapp_name].xml file in
> conf/Catalina/localhost or a context.xml file placed in the META-INF
> directory of a .war file unless you really want the resource available
> to all web applications in tomcat.
>
> On the admin webapp problems: I don't use it, so I can't help. Maybe
> someone else could comment?
>
> --David
>
> prakash shanmugam wrote:
>
> > hai david,
> > thank for sending those help files.now we are using tomcat 5.0.x.
> > our database is mysql and the Driver is com.sql.jdbc.Driver.
> >
> > when i am calling the jsp pages in my project its working fine,if i am
> > trying to communicate with database errorpage is thrown.
> > ******************
> > i had tried to create new *jndi* name through tomcat admin page.but the
> > changes are not reflecting in the usr/j-tomcat5.0/config/server.xml
> >
> > instead linux is creating a new xml file named as server.xml(plus date
> > and
> > time of creation) inthe same directory Even in that xml file also i
> > cont
> > see the jndi name and other changes, which i had done through admin
> page.
> >
> > i want to know how to configure the jndi name in the server.xml file
> >
> > since i am new to linux with tomcat i cont proceed with things, please
> > guide
> > me in the right direction
> >
> > bye
> > with regards
> > prakash s
> >
> >
> > On 9/26/06, David Smith <dn...@cornell.edu> wrote:
> >
> >>
> >> This is well documented on the tomcat site. What you've included below
> >> works on tomcat 5.0, but not 5.5. See the online docs:
> >>
> >> Tomcat 5.5 --
> >>
> >>
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
> >>
> >>
> >> Tomcat 5.0 --
> >>
> >>
> http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html
> >>
> >>
> >>
> >> What version of tomcat are you working with?
> >>
> >> --David
> >>
> >> prakash shanmugam wrote:
> >>
> >> > hai Li,
> >> > ur gussing is correct, i am using JNDI DS, here by i had pasted the
> >> > code
> >> > which is appended in the *server.xml. *
> >> >
> >> > *server.xml*
> >> >
> >> > <Context className="org.apache.catalina.core.StandardContext"
> >> > cachingAllowed="true" charsetMapperClass="
> >> > org.apache.catalina.util.CharsetMapper" cookies="true"
> >> > crossContext="false"
> >> > debug="0" displayName="Project Tracking System" docBase="opts7"
> >> > mapperClass="org.apache.catalina.core.StandardContextMapper"
> >> > path="/opts7"
> >> > privileged="false" reloadable="true" swallowOutput="false"
> >> > useNaming="true"
> >> > wrapperClass="org.apache.catalina.core.StandardWrapper">
> >> >
> >> > <Resource name="mine" scope="Shareable"
> >> > type="javax.sql.DataSource
> >> > "/>
> >> > <ResourceParams name="mine">
> >> > <parameter>
> >> > <name>maxWait</name>
> >> > <value>5000</value>
> >> > </parameter>
> >> > <parameter>
> >> > <name>maxActive</name>
> >> > <value>200</value>
> >> > </parameter>
> >> > <parameter>
> >> > <name>password</name>
> >> > <value></value>
> >> > </parameter>
> >> > <parameter>
> >> > <name>url</name>
> >> > <value>jdbc:mysql://100.100.100.6:3306/opts</value>
> >> > </parameter>
> >> > <parameter>
> >> > <name>driverClassName</name>
> >> > <value>com.mysql.jdbc.Driver</value>
> >> > </parameter>
> >> > <parameter>
> >> > <name>maxIdle</name>
> >> > <value>10</value>
> >> > </parameter>
> >> > <parameter>
> >> > <name>username</name>
> >> > <value>dav</value>
> >> > </parameter>
> >> > </ResourceParams>
> >> > </Context>
> >> >
> >> >
> >> > </Host>
> >> >
> >> > </Engine>
> >> > *web.xml*
> >> >
> >> > <resource-ref>
> >> > <description> DB Connection Pooling</description>
> >> > <res-ref-name>mine</res-ref-name>
> >> > <res-type> javax.sql.DataSource</res-type>
> >> > <res-auth> Container</res-auth>
> >> > </resource-ref>
> >> >
> >> > The above pasted code is working fine in windows, but our server in
> >> > linux.
> >> > we cont able to communicate to the database. please, check where i
> had
> >> > went
> >> > wrong...
> >> >
> >> > bye
> >> > with regrds
> >> > prakash
> >> >
> >> > On 9/26/06, Li <am...@gmail.com> wrote:
> >> >
> >> >>
> >> >> depends on what pool you use ...
> >> >>
> >> >> If use JNDI DS, you have to create a resource section in your
> >> >> server.xml:
> >> >>
> >> >> ....
> >> >> <engin ...>
> >> >> <host ...>
> >> >> <context ...>
> >> >> <Resource
> >> >> name="..."
> >> >> auth="Container"
> >> >> type="javax.sql.DataSource"
> >> >> username="..."
> >> >> password="..."
> >> >> driverClassName="..."
> >> >> url="..."
> >> >> maxActive="..."
> >> >> maxIdle="..."
> >> >> maxWait="..."
> >> >> ... />
> >> >> </context>
> >> >> </host>
> >> >> </engine>
> >> >> ...
> >> >>
> >> >> if you use other data source like hibernate's ... see their manual
> >> >>
> >> >> good luck
> >> >>
> >> >>
> >> >> On 9/26/06, prakash shanmugam <pr...@gmail.com> wrote:
> >> >> >
> >> >> > hai all,
> >> >> >
> >> >> > can u do one help ...
> >> >> > i need details about how to configure Connection Pooling in
> >> >> > Tomcat with MySQL in Linux platform...
> >> >> > i have done in windows platform..its working well..
> >> >> > i followed the same concepts in linux server also..
> >> >> > but it is not working... can u u hepl me in this regard..
> >> >> > it will be very much helpful for me if u do this..
> >> >> >
> >> >> > with regards
> >> >> > prakash
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >> --
> >> >> When we invent time, we invent death.
> >> >>
> >> >>
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> 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
>
>
--
Thanks and Regards
S.Prakash
Re: connection pooling in Linux using Tomcat 5.0.x and MYSQL
Posted by Li <am...@gmail.com>.
Hi,
No matter is Linux or Window, JNDi should be same. You can use the way I
wrote for your first reply. It works fine with 5.5.x both at
Linux/Unix/Windows.
Good luck
On 9/27/06, David Smith <dn...@cornell.edu> wrote:
>
> On JNDI connection problems: We'll need to see more. Specifically the
> jsp code calling for the sql connection and the web.xml. A full stack
> trace of the error you get would be excellent as well. Lastly, confirm
> the mysql jdbc driver is in common/lib of the tomcat directory, not
> WEB-INF/lib of your webapp.
>
> On configuring in server.xml, this is fast becoming a file that should
> be left alone for all but general server configuration. JNDI resources
> should be defined either in your [webapp_name].xml file in
> conf/Catalina/localhost or a context.xml file placed in the META-INF
> directory of a .war file unless you really want the resource available
> to all web applications in tomcat.
>
> On the admin webapp problems: I don't use it, so I can't help. Maybe
> someone else could comment?
>
> --David
>
> prakash shanmugam wrote:
>
> > hai david,
> > thank for sending those help files.now we are using tomcat 5.0.x.
> > our database is mysql and the Driver is com.sql.jdbc.Driver.
> >
> > when i am calling the jsp pages in my project its working fine,if i am
> > trying to communicate with database errorpage is thrown.
> > ******************
> > i had tried to create new *jndi* name through tomcat admin page.but the
> > changes are not reflecting in the usr/j-tomcat5.0/config/server.xml
> >
> > instead linux is creating a new xml file named as server.xml(plus date
> > and
> > time of creation) inthe same directory Even in that xml file also i
> > cont
> > see the jndi name and other changes, which i had done through admin
> page.
> >
> > i want to know how to configure the jndi name in the server.xml file
> >
> > since i am new to linux with tomcat i cont proceed with things, please
> > guide
> > me in the right direction
> >
> > bye
> > with regards
> > prakash s
> >
> >
> > On 9/26/06, David Smith <dn...@cornell.edu> wrote:
> >
> >>
> >> This is well documented on the tomcat site. What you've included below
> >> works on tomcat 5.0, but not 5.5. See the online docs:
> >>
> >> Tomcat 5.5 --
> >>
> >>
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
> >>
> >>
> >> Tomcat 5.0 --
> >>
> >>
> http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html
> >>
> >>
> >>
> >> What version of tomcat are you working with?
> >>
> >> --David
> >>
> >> prakash shanmugam wrote:
> >>
> >> > hai Li,
> >> > ur gussing is correct, i am using JNDI DS, here by i had pasted the
> >> > code
> >> > which is appended in the *server.xml. *
> >> >
> >> > *server.xml*
> >> >
> >> > <Context className="org.apache.catalina.core.StandardContext"
> >> > cachingAllowed="true" charsetMapperClass="
> >> > org.apache.catalina.util.CharsetMapper" cookies="true"
> >> > crossContext="false"
> >> > debug="0" displayName="Project Tracking System" docBase="opts7"
> >> > mapperClass="org.apache.catalina.core.StandardContextMapper"
> >> > path="/opts7"
> >> > privileged="false" reloadable="true" swallowOutput="false"
> >> > useNaming="true"
> >> > wrapperClass="org.apache.catalina.core.StandardWrapper">
> >> >
> >> > <Resource name="mine" scope="Shareable"
> >> > type="javax.sql.DataSource
> >> > "/>
> >> > <ResourceParams name="mine">
> >> > <parameter>
> >> > <name>maxWait</name>
> >> > <value>5000</value>
> >> > </parameter>
> >> > <parameter>
> >> > <name>maxActive</name>
> >> > <value>200</value>
> >> > </parameter>
> >> > <parameter>
> >> > <name>password</name>
> >> > <value></value>
> >> > </parameter>
> >> > <parameter>
> >> > <name>url</name>
> >> > <value>jdbc:mysql://100.100.100.6:3306/opts</value>
> >> > </parameter>
> >> > <parameter>
> >> > <name>driverClassName</name>
> >> > <value>com.mysql.jdbc.Driver</value>
> >> > </parameter>
> >> > <parameter>
> >> > <name>maxIdle</name>
> >> > <value>10</value>
> >> > </parameter>
> >> > <parameter>
> >> > <name>username</name>
> >> > <value>dav</value>
> >> > </parameter>
> >> > </ResourceParams>
> >> > </Context>
> >> >
> >> >
> >> > </Host>
> >> >
> >> > </Engine>
> >> > *web.xml*
> >> >
> >> > <resource-ref>
> >> > <description> DB Connection Pooling</description>
> >> > <res-ref-name>mine</res-ref-name>
> >> > <res-type> javax.sql.DataSource</res-type>
> >> > <res-auth> Container</res-auth>
> >> > </resource-ref>
> >> >
> >> > The above pasted code is working fine in windows, but our server in
> >> > linux.
> >> > we cont able to communicate to the database. please, check where i
> had
> >> > went
> >> > wrong...
> >> >
> >> > bye
> >> > with regrds
> >> > prakash
> >> >
> >> > On 9/26/06, Li <am...@gmail.com> wrote:
> >> >
> >> >>
> >> >> depends on what pool you use ...
> >> >>
> >> >> If use JNDI DS, you have to create a resource section in your
> >> >> server.xml:
> >> >>
> >> >> ....
> >> >> <engin ...>
> >> >> <host ...>
> >> >> <context ...>
> >> >> <Resource
> >> >> name="..."
> >> >> auth="Container"
> >> >> type="javax.sql.DataSource"
> >> >> username="..."
> >> >> password="..."
> >> >> driverClassName="..."
> >> >> url="..."
> >> >> maxActive="..."
> >> >> maxIdle="..."
> >> >> maxWait="..."
> >> >> ... />
> >> >> </context>
> >> >> </host>
> >> >> </engine>
> >> >> ...
> >> >>
> >> >> if you use other data source like hibernate's ... see their manual
> >> >>
> >> >> good luck
> >> >>
> >> >>
> >> >> On 9/26/06, prakash shanmugam <pr...@gmail.com> wrote:
> >> >> >
> >> >> > hai all,
> >> >> >
> >> >> > can u do one help ...
> >> >> > i need details about how to configure Connection Pooling in
> >> >> > Tomcat with MySQL in Linux platform...
> >> >> > i have done in windows platform..its working well..
> >> >> > i followed the same concepts in linux server also..
> >> >> > but it is not working... can u u hepl me in this regard..
> >> >> > it will be very much helpful for me if u do this..
> >> >> >
> >> >> > with regards
> >> >> > prakash
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >> --
> >> >> When we invent time, we invent death.
> >> >>
> >> >>
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> 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
>
>
--
When we invent time, we invent death.
Re: connection pooling in Linux using Tomcat 5.0.x and MYSQL
Posted by David Smith <dn...@cornell.edu>.
On JNDI connection problems: We'll need to see more. Specifically the
jsp code calling for the sql connection and the web.xml. A full stack
trace of the error you get would be excellent as well. Lastly, confirm
the mysql jdbc driver is in common/lib of the tomcat directory, not
WEB-INF/lib of your webapp.
On configuring in server.xml, this is fast becoming a file that should
be left alone for all but general server configuration. JNDI resources
should be defined either in your [webapp_name].xml file in
conf/Catalina/localhost or a context.xml file placed in the META-INF
directory of a .war file unless you really want the resource available
to all web applications in tomcat.
On the admin webapp problems: I don't use it, so I can't help. Maybe
someone else could comment?
--David
prakash shanmugam wrote:
> hai david,
> thank for sending those help files.now we are using tomcat 5.0.x.
> our database is mysql and the Driver is com.sql.jdbc.Driver.
>
> when i am calling the jsp pages in my project its working fine,if i am
> trying to communicate with database errorpage is thrown.
> ******************
> i had tried to create new *jndi* name through tomcat admin page.but the
> changes are not reflecting in the usr/j-tomcat5.0/config/server.xml
>
> instead linux is creating a new xml file named as server.xml(plus date
> and
> time of creation) inthe same directory Even in that xml file also i
> cont
> see the jndi name and other changes, which i had done through admin page.
>
> i want to know how to configure the jndi name in the server.xml file
>
> since i am new to linux with tomcat i cont proceed with things, please
> guide
> me in the right direction
>
> bye
> with regards
> prakash s
>
>
> On 9/26/06, David Smith <dn...@cornell.edu> wrote:
>
>>
>> This is well documented on the tomcat site. What you've included below
>> works on tomcat 5.0, but not 5.5. See the online docs:
>>
>> Tomcat 5.5 --
>>
>> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
>>
>>
>> Tomcat 5.0 --
>>
>> http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html
>>
>>
>>
>> What version of tomcat are you working with?
>>
>> --David
>>
>> prakash shanmugam wrote:
>>
>> > hai Li,
>> > ur gussing is correct, i am using JNDI DS, here by i had pasted the
>> > code
>> > which is appended in the *server.xml. *
>> >
>> > *server.xml*
>> >
>> > <Context className="org.apache.catalina.core.StandardContext"
>> > cachingAllowed="true" charsetMapperClass="
>> > org.apache.catalina.util.CharsetMapper" cookies="true"
>> > crossContext="false"
>> > debug="0" displayName="Project Tracking System" docBase="opts7"
>> > mapperClass="org.apache.catalina.core.StandardContextMapper"
>> > path="/opts7"
>> > privileged="false" reloadable="true" swallowOutput="false"
>> > useNaming="true"
>> > wrapperClass="org.apache.catalina.core.StandardWrapper">
>> >
>> > <Resource name="mine" scope="Shareable"
>> > type="javax.sql.DataSource
>> > "/>
>> > <ResourceParams name="mine">
>> > <parameter>
>> > <name>maxWait</name>
>> > <value>5000</value>
>> > </parameter>
>> > <parameter>
>> > <name>maxActive</name>
>> > <value>200</value>
>> > </parameter>
>> > <parameter>
>> > <name>password</name>
>> > <value></value>
>> > </parameter>
>> > <parameter>
>> > <name>url</name>
>> > <value>jdbc:mysql://100.100.100.6:3306/opts</value>
>> > </parameter>
>> > <parameter>
>> > <name>driverClassName</name>
>> > <value>com.mysql.jdbc.Driver</value>
>> > </parameter>
>> > <parameter>
>> > <name>maxIdle</name>
>> > <value>10</value>
>> > </parameter>
>> > <parameter>
>> > <name>username</name>
>> > <value>dav</value>
>> > </parameter>
>> > </ResourceParams>
>> > </Context>
>> >
>> >
>> > </Host>
>> >
>> > </Engine>
>> > *web.xml*
>> >
>> > <resource-ref>
>> > <description> DB Connection Pooling</description>
>> > <res-ref-name>mine</res-ref-name>
>> > <res-type> javax.sql.DataSource</res-type>
>> > <res-auth> Container</res-auth>
>> > </resource-ref>
>> >
>> > The above pasted code is working fine in windows, but our server in
>> > linux.
>> > we cont able to communicate to the database. please, check where i had
>> > went
>> > wrong...
>> >
>> > bye
>> > with regrds
>> > prakash
>> >
>> > On 9/26/06, Li <am...@gmail.com> wrote:
>> >
>> >>
>> >> depends on what pool you use ...
>> >>
>> >> If use JNDI DS, you have to create a resource section in your
>> >> server.xml:
>> >>
>> >> ....
>> >> <engin ...>
>> >> <host ...>
>> >> <context ...>
>> >> <Resource
>> >> name="..."
>> >> auth="Container"
>> >> type="javax.sql.DataSource"
>> >> username="..."
>> >> password="..."
>> >> driverClassName="..."
>> >> url="..."
>> >> maxActive="..."
>> >> maxIdle="..."
>> >> maxWait="..."
>> >> ... />
>> >> </context>
>> >> </host>
>> >> </engine>
>> >> ...
>> >>
>> >> if you use other data source like hibernate's ... see their manual
>> >>
>> >> good luck
>> >>
>> >>
>> >> On 9/26/06, prakash shanmugam <pr...@gmail.com> wrote:
>> >> >
>> >> > hai all,
>> >> >
>> >> > can u do one help ...
>> >> > i need details about how to configure Connection Pooling in
>> >> > Tomcat with MySQL in Linux platform...
>> >> > i have done in windows platform..its working well..
>> >> > i followed the same concepts in linux server also..
>> >> > but it is not working... can u u hepl me in this regard..
>> >> > it will be very much helpful for me if u do this..
>> >> >
>> >> > with regards
>> >> > prakash
>> >> >
>> >> >
>> >>
>> >>
>> >> --
>> >> When we invent time, we invent death.
>> >>
>> >>
>> >
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
>
>
---------------------------------------------------------------------
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
Re: connection pooling in Linux using Tomcat 5.0.x and MYSQL
Posted by prakash shanmugam <pr...@gmail.com>.
hai david,
thank for sending those help files.now we are using tomcat 5.0.x.
our database is mysql and the Driver is com.sql.jdbc.Driver.
when i am calling the jsp pages in my project its working fine,if i am
trying to communicate with database errorpage is thrown.
******************
i had tried to create new *jndi* name through tomcat admin page.but the
changes are not reflecting in the usr/j-tomcat5.0/config/server.xml
instead linux is creating a new xml file named as server.xml(plus date and
time of creation) inthe same directory Even in that xml file also i cont
see the jndi name and other changes, which i had done through admin page.
i want to know how to configure the jndi name in the server.xml file
since i am new to linux with tomcat i cont proceed with things, please guide
me in the right direction
bye
with regards
prakash s
On 9/26/06, David Smith <dn...@cornell.edu> wrote:
>
> This is well documented on the tomcat site. What you've included below
> works on tomcat 5.0, but not 5.5. See the online docs:
>
> Tomcat 5.5 --
>
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
>
> Tomcat 5.0 --
>
> http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html
>
>
> What version of tomcat are you working with?
>
> --David
>
> prakash shanmugam wrote:
>
> > hai Li,
> > ur gussing is correct, i am using JNDI DS, here by i had pasted the
> > code
> > which is appended in the *server.xml. *
> >
> > *server.xml*
> >
> > <Context className="org.apache.catalina.core.StandardContext"
> > cachingAllowed="true" charsetMapperClass="
> > org.apache.catalina.util.CharsetMapper" cookies="true"
> > crossContext="false"
> > debug="0" displayName="Project Tracking System" docBase="opts7"
> > mapperClass="org.apache.catalina.core.StandardContextMapper"
> > path="/opts7"
> > privileged="false" reloadable="true" swallowOutput="false"
> > useNaming="true"
> > wrapperClass="org.apache.catalina.core.StandardWrapper">
> >
> > <Resource name="mine" scope="Shareable"
> > type="javax.sql.DataSource
> > "/>
> > <ResourceParams name="mine">
> > <parameter>
> > <name>maxWait</name>
> > <value>5000</value>
> > </parameter>
> > <parameter>
> > <name>maxActive</name>
> > <value>200</value>
> > </parameter>
> > <parameter>
> > <name>password</name>
> > <value></value>
> > </parameter>
> > <parameter>
> > <name>url</name>
> > <value>jdbc:mysql://100.100.100.6:3306/opts</value>
> > </parameter>
> > <parameter>
> > <name>driverClassName</name>
> > <value>com.mysql.jdbc.Driver</value>
> > </parameter>
> > <parameter>
> > <name>maxIdle</name>
> > <value>10</value>
> > </parameter>
> > <parameter>
> > <name>username</name>
> > <value>dav</value>
> > </parameter>
> > </ResourceParams>
> > </Context>
> >
> >
> > </Host>
> >
> > </Engine>
> > *web.xml*
> >
> > <resource-ref>
> > <description> DB Connection Pooling</description>
> > <res-ref-name>mine</res-ref-name>
> > <res-type> javax.sql.DataSource</res-type>
> > <res-auth> Container</res-auth>
> > </resource-ref>
> >
> > The above pasted code is working fine in windows, but our server in
> > linux.
> > we cont able to communicate to the database. please, check where i had
> > went
> > wrong...
> >
> > bye
> > with regrds
> > prakash
> >
> > On 9/26/06, Li <am...@gmail.com> wrote:
> >
> >>
> >> depends on what pool you use ...
> >>
> >> If use JNDI DS, you have to create a resource section in your
> >> server.xml:
> >>
> >> ....
> >> <engin ...>
> >> <host ...>
> >> <context ...>
> >> <Resource
> >> name="..."
> >> auth="Container"
> >> type="javax.sql.DataSource"
> >> username="..."
> >> password="..."
> >> driverClassName="..."
> >> url="..."
> >> maxActive="..."
> >> maxIdle="..."
> >> maxWait="..."
> >> ... />
> >> </context>
> >> </host>
> >> </engine>
> >> ...
> >>
> >> if you use other data source like hibernate's ... see their manual
> >>
> >> good luck
> >>
> >>
> >> On 9/26/06, prakash shanmugam <pr...@gmail.com> wrote:
> >> >
> >> > hai all,
> >> >
> >> > can u do one help ...
> >> > i need details about how to configure Connection Pooling in
> >> > Tomcat with MySQL in Linux platform...
> >> > i have done in windows platform..its working well..
> >> > i followed the same concepts in linux server also..
> >> > but it is not working... can u u hepl me in this regard..
> >> > it will be very much helpful for me if u do this..
> >> >
> >> > with regards
> >> > prakash
> >> >
> >> >
> >>
> >>
> >> --
> >> When we invent time, we invent death.
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> 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
>
>
--
Thanks and Regards
S.Prakash
Re: connection pooling in Linux using Tomcat 5.0.x and MYSQL
Posted by David Smith <dn...@cornell.edu>.
This is well documented on the tomcat site. What you've included below
works on tomcat 5.0, but not 5.5. See the online docs:
Tomcat 5.5 --
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
Tomcat 5.0 --
http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html
What version of tomcat are you working with?
--David
prakash shanmugam wrote:
> hai Li,
> ur gussing is correct, i am using JNDI DS, here by i had pasted the
> code
> which is appended in the *server.xml. *
>
> *server.xml*
>
> <Context className="org.apache.catalina.core.StandardContext"
> cachingAllowed="true" charsetMapperClass="
> org.apache.catalina.util.CharsetMapper" cookies="true"
> crossContext="false"
> debug="0" displayName="Project Tracking System" docBase="opts7"
> mapperClass="org.apache.catalina.core.StandardContextMapper"
> path="/opts7"
> privileged="false" reloadable="true" swallowOutput="false"
> useNaming="true"
> wrapperClass="org.apache.catalina.core.StandardWrapper">
>
> <Resource name="mine" scope="Shareable"
> type="javax.sql.DataSource
> "/>
> <ResourceParams name="mine">
> <parameter>
> <name>maxWait</name>
> <value>5000</value>
> </parameter>
> <parameter>
> <name>maxActive</name>
> <value>200</value>
> </parameter>
> <parameter>
> <name>password</name>
> <value></value>
> </parameter>
> <parameter>
> <name>url</name>
> <value>jdbc:mysql://100.100.100.6:3306/opts</value>
> </parameter>
> <parameter>
> <name>driverClassName</name>
> <value>com.mysql.jdbc.Driver</value>
> </parameter>
> <parameter>
> <name>maxIdle</name>
> <value>10</value>
> </parameter>
> <parameter>
> <name>username</name>
> <value>dav</value>
> </parameter>
> </ResourceParams>
> </Context>
>
>
> </Host>
>
> </Engine>
> *web.xml*
>
> <resource-ref>
> <description> DB Connection Pooling</description>
> <res-ref-name>mine</res-ref-name>
> <res-type> javax.sql.DataSource</res-type>
> <res-auth> Container</res-auth>
> </resource-ref>
>
> The above pasted code is working fine in windows, but our server in
> linux.
> we cont able to communicate to the database. please, check where i had
> went
> wrong...
>
> bye
> with regrds
> prakash
>
> On 9/26/06, Li <am...@gmail.com> wrote:
>
>>
>> depends on what pool you use ...
>>
>> If use JNDI DS, you have to create a resource section in your
>> server.xml:
>>
>> ....
>> <engin ...>
>> <host ...>
>> <context ...>
>> <Resource
>> name="..."
>> auth="Container"
>> type="javax.sql.DataSource"
>> username="..."
>> password="..."
>> driverClassName="..."
>> url="..."
>> maxActive="..."
>> maxIdle="..."
>> maxWait="..."
>> ... />
>> </context>
>> </host>
>> </engine>
>> ...
>>
>> if you use other data source like hibernate's ... see their manual
>>
>> good luck
>>
>>
>> On 9/26/06, prakash shanmugam <pr...@gmail.com> wrote:
>> >
>> > hai all,
>> >
>> > can u do one help ...
>> > i need details about how to configure Connection Pooling in
>> > Tomcat with MySQL in Linux platform...
>> > i have done in windows platform..its working well..
>> > i followed the same concepts in linux server also..
>> > but it is not working... can u u hepl me in this regard..
>> > it will be very much helpful for me if u do this..
>> >
>> > with regards
>> > prakash
>> >
>> >
>>
>>
>> --
>> When we invent time, we invent death.
>>
>>
>
---------------------------------------------------------------------
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
Re: connection pooling in Linux using Tomcat 5.0.x and MYSQL
Posted by prakash shanmugam <pr...@gmail.com>.
hai Li,
ur gussing is correct, i am using JNDI DS, here by i had pasted the code
which is appended in the *server.xml. *
*server.xml*
<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true" charsetMapperClass="
org.apache.catalina.util.CharsetMapper" cookies="true" crossContext="false"
debug="0" displayName="Project Tracking System" docBase="opts7"
mapperClass="org.apache.catalina.core.StandardContextMapper" path="/opts7"
privileged="false" reloadable="true" swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper">
<Resource name="mine" scope="Shareable" type="javax.sql.DataSource
"/>
<ResourceParams name="mine">
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>200</value>
</parameter>
<parameter>
<name>password</name>
<value></value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://100.100.100.6:3306/opts</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>username</name>
<value>dav</value>
</parameter>
</ResourceParams>
</Context>
</Host>
</Engine>
*web.xml*
<resource-ref>
<description> DB Connection Pooling</description>
<res-ref-name>mine</res-ref-name>
<res-type> javax.sql.DataSource</res-type>
<res-auth> Container</res-auth>
</resource-ref>
The above pasted code is working fine in windows, but our server in linux.
we cont able to communicate to the database. please, check where i had went
wrong...
bye
with regrds
prakash
On 9/26/06, Li <am...@gmail.com> wrote:
>
> depends on what pool you use ...
>
> If use JNDI DS, you have to create a resource section in your server.xml:
>
> ....
> <engin ...>
> <host ...>
> <context ...>
> <Resource
> name="..."
> auth="Container"
> type="javax.sql.DataSource"
> username="..."
> password="..."
> driverClassName="..."
> url="..."
> maxActive="..."
> maxIdle="..."
> maxWait="..."
> ... />
> </context>
> </host>
> </engine>
> ...
>
> if you use other data source like hibernate's ... see their manual
>
> good luck
>
>
> On 9/26/06, prakash shanmugam <pr...@gmail.com> wrote:
> >
> > hai all,
> >
> > can u do one help ...
> > i need details about how to configure Connection Pooling in
> > Tomcat with MySQL in Linux platform...
> > i have done in windows platform..its working well..
> > i followed the same concepts in linux server also..
> > but it is not working... can u u hepl me in this regard..
> > it will be very much helpful for me if u do this..
> >
> > with regards
> > prakash
> >
> >
>
>
> --
> When we invent time, we invent death.
>
>
Re: connection pooling in Linux using Tomcat 5.0.x and MYSQL
Posted by Li <am...@gmail.com>.
depends on what pool you use ...
If use JNDI DS, you have to create a resource section in your server.xml:
....
<engin ...>
<host ...>
<context ...>
<Resource
name="..."
auth="Container"
type="javax.sql.DataSource"
username="..."
password="..."
driverClassName="..."
url="..."
maxActive="..."
maxIdle="..."
maxWait="..."
... />
</context>
</host>
</engine>
...
if you use other data source like hibernate's ... see their manual
good luck
On 9/26/06, prakash shanmugam <pr...@gmail.com> wrote:
>
> hai all,
>
> can u do one help ...
> i need details about how to configure Connection Pooling in
> Tomcat with MySQL in Linux platform...
> i have done in windows platform..its working well..
> i followed the same concepts in linux server also..
> but it is not working... can u u hepl me in this regard..
> it will be very much helpful for me if u do this..
>
> with regards
> prakash
>
>
--
When we invent time, we invent death.