Re: [OT] Connection Pooling

2007-05-22 Thread Balazs Michnay
) envCtx.lookup(jdbc/akr_db);

This might be the problem... why is that?

Thanks for helping again!!

Regards,

  BM



- Original Message 
From: Christopher Schultz [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Monday, May 21, 2007 2:33:11 PM
Subject: Re: [OT] Connection Pooling

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Balazs,

Balazs Michnay wrote:
 I still cannot estabilish database connection using connection pooling.
 I think I made all the settings I need, but still nothing...
 1) I have a context tag in my server.xml

Can you show us the connection settings you are using? You only showed
the code (which looked fine, except that you don't need to check for
null after you create a new InitialContext... I'm pretty sure that an
object creation can't return null).

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGUZGG9CaO5/Lv0PARAm8OAJ0cXJTmHSXhX8prghRHixkEbU89KACeL71M
LYCgqlaLzn1mIzUZsGo9c8A=
=aJtP
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]








   
Pinpoint
 customers who are looking for what you sell. 
http://searchmarketing.yahoo.com/

Re: [OT] Connection Pooling

2007-05-22 Thread Nuwan Chandrasoma

hi,

i just had a look, i think your url is wrong.

where is the DB name?

eg:- you have it like jdbc:mysql://localhost:3306

but should be like: jdbc:mysql://localhost:3306/akr_db

Thanks,

Nuwan




- Original Message - 
From: Balazs Michnay [EMAIL PROTECTED]

To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, May 22, 2007 6:39 AM
Subject: Re: [OT] Connection Pooling



Thanks for helping.
Sure, here are all my settings.
I use MySQL 5.0.37, Tomcat 5.5.17 and Windows XP SP2 and MySQL Connector/J 
5.0.5.
The name of the database that I'd like to connect to is called akr_db 
and the name of my web-application is called SZTGKR.


1) I have a context.xml file in my web/Meta-INF directory with the 
following contents:


- CONTEXT.XML

?xml version=1.0 encoding=UTF-8?
Context crossContext=true debug=5 docBase=SZTGKR path=/SZTGKR 
reloadable=true
 Logger className=org.apache.catalina.logger.FileLogger 
prefix=localhost_akr_db_log. suffix=.txt timestamp=true/
 Resource auth=Container name=jdbc/akr_db 
type=javax.sql.DataSource/

 ResourceParams name=jdbc/akr_db
   parameter
 namefactory/name
 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
   /parameter
   parameter
 nameremoveAbandoned/name
 valuetrue/value
   /parameter
   parameter
 nameremoveAbandonedTimeout/name
 value60/value
   /parameter
   parameter
 namelogAbandoned/name
 valuetrue/value
   /parameter
   !-- Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit.
--
   parameter
 namemaxActive/name
 value100/value
   /parameter
   !-- Maximum number of idle dB connections to retain in pool.
Set to 0 for no limit.
--
   parameter
 namemaxIdle/name
 value30/value
   /parameter
   !-- Maximum time to wait for a dB connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded.  Set to -1 to wait indefinitely.
--
   parameter
 namemaxWait/name
 value1/value
   /parameter
   !-- MySQL dB username and password for dB connections  --
   parameter
 nameusername/name
 valuebalazs/value
   /parameter
   parameter
 namepassword/name
 value12345/value
   /parameter
   !-- Class name for mm.mysql JDBC driver --
   parameter
 namedriverClassName/name
 valuecom.mysql.jdbc.Driver/value
   /parameter
   !-- The JDBC connection url for connecting to your MySQL dB.
The autoReconnect=true argument to the url makes sure that the
mm.mysql JDBC Driver will automatically reconnect if mysqld closed 
the
connection.  mysqld by default closes idle connections after 8 
hours.

--
   parameter
 nameurl/name
 valuejdbc:mysql://localhost:3306/value
   /parameter
 /ResourceParams
/Context
-END OF CONTEXT.XML

I have a java class, that (presumably) creates (or returns...?) my 
connection pool:


- DBTEST.JAVA

package db_helpers;

import javax.naming.*;
import javax.sql.*;
import java.sql.*;

public class DBTest {

   String foo = Not Connected;
   String bar = Empty;

   public void init() {
   try{

   Context ctx = new InitialContext();
   if(ctx == null )
   throw new Exception(Boom - No Context);

   Context envCtx = (Context) ctx.lookup(java:comp/env);
   DataSource ds = (DataSource) envCtx.lookup(jdbc/akr_db);

   if (ds != null) {
   Connection conn = ds.getConnection();

   if(conn != null)  {
   foo = Got Connection +conn.toString();
   Statement stmt = conn.createStatement();
   ResultSet rst =
   stmt.executeQuery(
   select ID_paciens, vezeteknev, keresztnev from 
torzs_paciens);

   if(rst.next()) {
   foo=rst.getString(2);
   bar=rst.getString(3);
   }
   conn.close();
   }
   }
   }catch(Exception e) {
   e.printStackTrace();
   }
   }

   public String getFoo() { return foo; }
   public String getBar() { return bar;}
}

- END OF DBTEST.JAVA

Here, my

Connection conn = ds.getConnection();

statement fails.

And finally I have a JSP, in which I'd like to use my connection pool:

-- DBTEST.JSP
...
   %
   db_helpers.DBTest tst = new db_helpers.DBTest();
   tst.init();
   %

   h2Results/h2
   Foo %= tst.getFoo() %br/
   Bar %= tst.getBar() %
...
-- END OF DBTEST.JSP

Do I have anything else to connect to my db using connection pooling?
So again, it's the Connection conn = ds.getConnection();, where my 
program fails, it says

Re: [OT] Connection Pooling

2007-05-22 Thread Balazs Michnay
Still the same error message and the same symptoms: the url and the driverclass 
properties are still null:   :-((

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of 
class '' for connect URL 'null'

ohhh... what am I missing ??!!

- Original Message 
From: Nuwan Chandrasoma [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, May 22, 2007 2:33:34 PM
Subject: Re: [OT] Connection Pooling

hi,

i just had a look, i think your url is wrong.

where is the DB name?

eg:- you have it like jdbc:mysql://localhost:3306

but should be like: jdbc:mysql://localhost:3306/akr_db

Thanks,

Nuwan




- Original Message - 
From: Balazs Michnay [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, May 22, 2007 6:39 AM
Subject: Re: [OT] Connection Pooling


 Thanks for helping.
 Sure, here are all my settings.
 I use MySQL 5.0.37, Tomcat 5.5.17 and Windows XP SP2 and MySQL Connector/J 
 5.0.5.
 The name of the database that I'd like to connect to is called akr_db 
 and the name of my web-application is called SZTGKR.

 1) I have a context.xml file in my web/Meta-INF directory with the 
 following contents:

 - CONTEXT.XML

 ?xml version=1.0 encoding=UTF-8?
 Context crossContext=true debug=5 docBase=SZTGKR path=/SZTGKR 
 reloadable=true
  Logger className=org.apache.catalina.logger.FileLogger 
 prefix=localhost_akr_db_log. suffix=.txt timestamp=true/
  Resource auth=Container name=jdbc/akr_db 
 type=javax.sql.DataSource/
  ResourceParams name=jdbc/akr_db
parameter
  namefactory/name
  valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
parameter
  nameremoveAbandoned/name
  valuetrue/value
/parameter
parameter
  nameremoveAbandonedTimeout/name
  value60/value
/parameter
parameter
  namelogAbandoned/name
  valuetrue/value
/parameter
!-- Maximum number of dB connections in pool. Make sure you
 configure your mysqld max_connections large enough to handle
 all of your db connections. Set to 0 for no limit.
 --
parameter
  namemaxActive/name
  value100/value
/parameter
!-- Maximum number of idle dB connections to retain in pool.
 Set to 0 for no limit.
 --
parameter
  namemaxIdle/name
  value30/value
/parameter
!-- Maximum time to wait for a dB connection to become available
 in ms, in this example 10 seconds. An Exception is thrown if
 this timeout is exceeded.  Set to -1 to wait indefinitely.
 --
parameter
  namemaxWait/name
  value1/value
/parameter
!-- MySQL dB username and password for dB connections  --
parameter
  nameusername/name
  valuebalazs/value
/parameter
parameter
  namepassword/name
  value12345/value
/parameter
!-- Class name for mm.mysql JDBC driver --
parameter
  namedriverClassName/name
  valuecom.mysql.jdbc.Driver/value
/parameter
!-- The JDBC connection url for connecting to your MySQL dB.
 The autoReconnect=true argument to the url makes sure that the
 mm.mysql JDBC Driver will automatically reconnect if mysqld closed 
 the
 connection.  mysqld by default closes idle connections after 8 
 hours.
 --
parameter
  nameurl/name
  valuejdbc:mysql://localhost:3306/value
/parameter
  /ResourceParams
 /Context
 -END OF CONTEXT.XML

 I have a java class, that (presumably) creates (or returns...?) my 
 connection pool:

 - DBTEST.JAVA

 package db_helpers;

 import javax.naming.*;
 import javax.sql.*;
 import java.sql.*;

 public class DBTest {

String foo = Not Connected;
String bar = Empty;

public void init() {
try{

Context ctx = new InitialContext();
if(ctx == null )
throw new Exception(Boom - No Context);

Context envCtx = (Context) ctx.lookup(java:comp/env);
DataSource ds = (DataSource) envCtx.lookup(jdbc/akr_db);

if (ds != null) {
Connection conn = ds.getConnection();

if(conn != null)  {
foo = Got Connection +conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst =
stmt.executeQuery(
select ID_paciens, vezeteknev, keresztnev from 
 torzs_paciens);
if(rst.next()) {
foo=rst.getString(2);
bar=rst.getString(3);
}
conn.close();
}
}
}catch(Exception e) {
e.printStackTrace();
}
}

public String getFoo() { return foo; }
public String getBar() { return bar;}
 }

 - END OF DBTEST.JAVA

 Here, my

Re: [OT] Connection Pooling

2007-05-22 Thread Balazs Michnay
I forgot that I also have a resource-ref entry in my web.xml file... just in 
case it counts...

resource-ref
descriptionDB Connection/description
res-ref-namejdbc/akr_db/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref

But still nothing :(

Thanks,

BM


- Original Message 
From: Nuwan Chandrasoma [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, May 22, 2007 2:33:34 PM
Subject: Re: [OT] Connection Pooling

hi,

i just had a look, i think your url is wrong.

where is the DB name?

eg:- you have it like jdbc:mysql://localhost:3306

but should be like: jdbc:mysql://localhost:3306/akr_db

Thanks,

Nuwan




- Original Message - 
From: Balazs Michnay [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, May 22, 2007 6:39 AM
Subject: Re: [OT] Connection Pooling


 Thanks for helping.
 Sure, here are all my settings.
 I use MySQL 5.0.37, Tomcat 5.5.17 and Windows XP SP2 and MySQL Connector/J 
 5.0.5.
 The name of the database that I'd like to connect to is called akr_db 
 and the name of my web-application is called SZTGKR.

 1) I have a context.xml file in my web/Meta-INF directory with the 
 following contents:

 - CONTEXT.XML

 ?xml version=1.0 encoding=UTF-8?
 Context crossContext=true debug=5 docBase=SZTGKR path=/SZTGKR 
 reloadable=true
  Logger className=org.apache.catalina.logger.FileLogger 
 prefix=localhost_akr_db_log. suffix=.txt timestamp=true/
  Resource auth=Container name=jdbc/akr_db 
 type=javax.sql.DataSource/
  ResourceParams name=jdbc/akr_db
parameter
  namefactory/name
  valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
parameter
  nameremoveAbandoned/name
  valuetrue/value
/parameter
parameter
  nameremoveAbandonedTimeout/name
  value60/value
/parameter
parameter
  namelogAbandoned/name
  valuetrue/value
/parameter
!-- Maximum number of dB connections in pool. Make sure you
 configure your mysqld max_connections large enough to handle
 all of your db connections. Set to 0 for no limit.
 --
parameter
  namemaxActive/name
  value100/value
/parameter
!-- Maximum number of idle dB connections to retain in pool.
 Set to 0 for no limit.
 --
parameter
  namemaxIdle/name
  value30/value
/parameter
!-- Maximum time to wait for a dB connection to become available
 in ms, in this example 10 seconds. An Exception is thrown if
 this timeout is exceeded.  Set to -1 to wait indefinitely.
 --
parameter
  namemaxWait/name
  value1/value
/parameter
!-- MySQL dB username and password for dB connections  --
parameter
  nameusername/name
  valuebalazs/value
/parameter
parameter
  namepassword/name
  value12345/value
/parameter
!-- Class name for mm.mysql JDBC driver --
parameter
  namedriverClassName/name
  valuecom.mysql.jdbc.Driver/value
/parameter
!-- The JDBC connection url for connecting to your MySQL dB.
 The autoReconnect=true argument to the url makes sure that the
 mm.mysql JDBC Driver will automatically reconnect if mysqld closed 
 the
 connection.  mysqld by default closes idle connections after 8 
 hours.
 --
parameter
  nameurl/name
  valuejdbc:mysql://localhost:3306/value
/parameter
  /ResourceParams
 /Context
 -END OF CONTEXT.XML

 I have a java class, that (presumably) creates (or returns...?) my 
 connection pool:

 - DBTEST.JAVA

 package db_helpers;

 import javax.naming.*;
 import javax.sql.*;
 import java.sql.*;

 public class DBTest {

String foo = Not Connected;
String bar = Empty;

public void init() {
try{

Context ctx = new InitialContext();
if(ctx == null )
throw new Exception(Boom - No Context);

Context envCtx = (Context) ctx.lookup(java:comp/env);
DataSource ds = (DataSource) envCtx.lookup(jdbc/akr_db);

if (ds != null) {
Connection conn = ds.getConnection();

if(conn != null)  {
foo = Got Connection +conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst =
stmt.executeQuery(
select ID_paciens, vezeteknev, keresztnev from 
 torzs_paciens);
if(rst.next()) {
foo=rst.getString(2);
bar=rst.getString(3);
}
conn.close();
}
}
}catch(Exception e) {
e.printStackTrace();
}
}

public String getFoo() { return foo; }
public String getBar() { return

Re: [OT] Connection Pooling

2007-05-22 Thread Nuwan Chandrasoma

Hi,

Sorry mate, i think you should ask this from another group like tomcat.., 
hope this link would give you some help


http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html

Thanks,

Nuwan


- Original Message - 
From: Balazs Michnay [EMAIL PROTECTED]

To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, May 22, 2007 7:34 AM
Subject: Re: [OT] Connection Pooling


I forgot that I also have a resource-ref entry in my web.xml file... just 
in case it counts...


resource-ref
   descriptionDB Connection/description
   res-ref-namejdbc/akr_db/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
/resource-ref

But still nothing :(

Thanks,

BM


- Original Message 
From: Nuwan Chandrasoma [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, May 22, 2007 2:33:34 PM
Subject: Re: [OT] Connection Pooling

hi,

i just had a look, i think your url is wrong.

where is the DB name?

eg:- you have it like jdbc:mysql://localhost:3306

but should be like: jdbc:mysql://localhost:3306/akr_db

Thanks,

Nuwan




- Original Message - 
From: Balazs Michnay [EMAIL PROTECTED]

To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, May 22, 2007 6:39 AM
Subject: Re: [OT] Connection Pooling



Thanks for helping.
Sure, here are all my settings.
I use MySQL 5.0.37, Tomcat 5.5.17 and Windows XP SP2 and MySQL 
Connector/J

5.0.5.
The name of the database that I'd like to connect to is called akr_db
and the name of my web-application is called SZTGKR.

1) I have a context.xml file in my web/Meta-INF directory with the
following contents:

- CONTEXT.XML

?xml version=1.0 encoding=UTF-8?
Context crossContext=true debug=5 docBase=SZTGKR path=/SZTGKR
reloadable=true
 Logger className=org.apache.catalina.logger.FileLogger
prefix=localhost_akr_db_log. suffix=.txt timestamp=true/
 Resource auth=Container name=jdbc/akr_db
type=javax.sql.DataSource/
 ResourceParams name=jdbc/akr_db
   parameter
 namefactory/name
 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
   /parameter
   parameter
 nameremoveAbandoned/name
 valuetrue/value
   /parameter
   parameter
 nameremoveAbandonedTimeout/name
 value60/value
   /parameter
   parameter
 namelogAbandoned/name
 valuetrue/value
   /parameter
   !-- Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit.
--
   parameter
 namemaxActive/name
 value100/value
   /parameter
   !-- Maximum number of idle dB connections to retain in pool.
Set to 0 for no limit.
--
   parameter
 namemaxIdle/name
 value30/value
   /parameter
   !-- Maximum time to wait for a dB connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded.  Set to -1 to wait indefinitely.
--
   parameter
 namemaxWait/name
 value1/value
   /parameter
   !-- MySQL dB username and password for dB connections  --
   parameter
 nameusername/name
 valuebalazs/value
   /parameter
   parameter
 namepassword/name
 value12345/value
   /parameter
   !-- Class name for mm.mysql JDBC driver --
   parameter
 namedriverClassName/name
 valuecom.mysql.jdbc.Driver/value
   /parameter
   !-- The JDBC connection url for connecting to your MySQL dB.
The autoReconnect=true argument to the url makes sure that the
mm.mysql JDBC Driver will automatically reconnect if mysqld 
closed

the
connection.  mysqld by default closes idle connections after 8
hours.
--
   parameter
 nameurl/name
 valuejdbc:mysql://localhost:3306/value
   /parameter
 /ResourceParams
/Context
-END OF CONTEXT.XML

I have a java class, that (presumably) creates (or returns...?) my
connection pool:

- DBTEST.JAVA

package db_helpers;

import javax.naming.*;
import javax.sql.*;
import java.sql.*;

public class DBTest {

   String foo = Not Connected;
   String bar = Empty;

   public void init() {
   try{

   Context ctx = new InitialContext();
   if(ctx == null )
   throw new Exception(Boom - No Context);

   Context envCtx = (Context) ctx.lookup(java:comp/env);
   DataSource ds = (DataSource) envCtx.lookup(jdbc/akr_db);

   if (ds != null) {
   Connection conn = ds.getConnection();

   if(conn != null)  {
   foo = Got Connection +conn.toString();
   Statement stmt = conn.createStatement();
   ResultSet rst =
   stmt.executeQuery(
   select ID_paciens, vezeteknev, keresztnev 
from

torzs_paciens);
   if(rst.next()) {
   foo

Re: [OT] Connection Pooling

2007-05-22 Thread Balazs Michnay
Many thanks for your help, I managed to set connection pooling up (however, I 
don't know whether it uses conn. pooling or not...)
To help others, here are all the configurations that need to be done:
(This works with Tomcat 5.5, MySQL 5.0, Win XP SP2)

1) Place your database driver in your $CATALINA_HOME/common/lib directory along 
with the all the required jars (commons-dbcp, commons-pool, commons-collection)

2) open your server.xml and put the following lines between 
GlobalNamingResources/GlobalNamingResources tags (this is what I missed...)
(Modify it properly...)

Resource name=jdbc/akr_db auth=Container
  type=javax.sql.DataSource removeAbandoned=true
  removeAbandonedTimeout=30 maxActive=100
  maxIdle=30 maxWait=1 username=balazs
  password=12345
  driverClassName=com.mysql.jdbc.Driver
  url=jdbc:mysql://localhost:3306/akr_db/

3) Create a context.xml file in your META-INF directory with the following 
contents:

?xml version=1.0 encoding=UTF-8?
Context
ResourceLink global=jdbc/akr_db name=jdbc/akr_db 
type=javax.sql.DataSource/
/Context

(Modify it properly...)

4) Create a Java class with the following contents to get a connection from the 
pool:

public class DBTest {

String foo = Not Connected;
String bar = Empty;

public void init() {

Connection conn = null;
Statement stmt = null;  // Or PreparedStatement if needed
ResultSet rst = null;

try{

Context ctx = new InitialContext();
if(ctx == null )
throw new Exception(Boom - No Context);

Context envCtx = (Context) ctx.lookup(java:comp/env);
DataSource ds = (DataSource) envCtx.lookup(jdbc/akr_db);

if (ds != null) {
conn = ds.getConnection();

if(conn != null)  {
foo = Got Connection +conn.toString();
stmt = conn.createStatement();
rst =
stmt.executeQuery(
select ID_paciens, vezeteknev, keresztnev from 
torzs_paciens);
if(rst.next()) {
foo=rst.getString(2);
bar=rst.getString(3);
}
stmt.close();
stmt = null;

conn.close();
conn = null;

rst.close();
rst = null;
}
}
}catch(Exception e) {
e.printStackTrace();
} finally {
// Always make sure result sets and statements are closed,
// and the connection is returned to the pool
if (rst != null) {
try { rst.close(); } catch (SQLException e) { ; }
rst = null;
}
if (stmt != null) {
try { stmt.close(); } catch (SQLException e) { ; }
stmt = null;
}
if (conn != null) {
try { conn.close(); } catch (SQLException e) { ; }
conn = null;
}
}
}

public String getFoo() { return foo; }
public String getBar() { return bar;}
}

5) Use the class from your JSP:

%
db_helpers.DBTest tst = new db_helpers.DBTest();
tst.init();
%

h2Results/h2
Foo %= tst.getFoo() %br/
Bar %= tst.getBar() %

--

- Original Message 
From: Nuwan Chandrasoma [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, May 22, 2007 3:38:54 PM
Subject: Re: [OT] Connection Pooling

Hi,

Sorry mate, i think you should ask this from another group like tomcat.., 
hope this link would give you some help

http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html

Thanks,

Nuwan


- Original Message - 
From: Balazs Michnay [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, May 22, 2007 7:34 AM
Subject: Re: [OT] Connection Pooling


I forgot that I also have a resource-ref entry in my web.xml file... just 
in case it counts...

 resource-ref
descriptionDB Connection/description
res-ref-namejdbc/akr_db/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
 /resource-ref

 But still nothing :(

 Thanks,

 BM


 - Original Message 
 From: Nuwan Chandrasoma [EMAIL PROTECTED]
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Tuesday, May 22, 2007 2:33:34 PM
 Subject: Re: [OT] Connection Pooling

 hi,

 i just had a look, i think your url is wrong.

 where is the DB name?

 eg:- you have it like jdbc:mysql://localhost:3306

 but should be like: jdbc:mysql://localhost:3306/akr_db

 Thanks

Re: [OT] Connection Pooling

2007-05-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Balazs,

Balazs Michnay wrote:
 Thanks for helping.
 Sure, here are all my settings.

I think you have more configuration than you need. Here is exactly what
I have for a similar setup (MySQL 5.x, Connector/J 5.x, Tomcat 5.5.x):

Context reloadable=true
   Resource name=@DATASOURCE_REF@
auth=Container
type=javax.sql.DataSource
maxActive=1
maxIdle=1
maxWait=1
url=@DATABASE_URL@
username=@DATABASE_USERNAME@
password=@DATABASE_PASSWORD@
driverClassName=@DATABASE_DRIVER@
removeAbandoned=true
removeAbandonedTimeout=30
logAbandoned=true /

I checked, and all the values you are currently using for these settings
look good. I'm not sure what the problem might be, but this
configuration is /way/ easier to read. Perhaps ResourceParams is no
longer used in TC 5.5... I used to use it in 4.1.x (with this
configuration in server.xml), but when I upgraded, I started using this
shorter syntax in the webapp's context.xml.

The error message Cannot create JDBC driver of class '' for connect URL
'null' usually just means you are missing some tiny piece of
configuration (or you have one tiny thing wrong). The devil is in the
details...

Hope that helps,
- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGUun79CaO5/Lv0PARAudkAJ9eQ9fxkuDJp+hF448KDpwPQJTzgACgnRWb
2SwXA4Jm75edJg28Nq5z/AE=
=59qq
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] Connection Pooling

2007-05-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Balazs,

Balazs Michnay wrote:
 2) open your server.xml and put the following lines between 
 GlobalNamingResources/GlobalNamingResources tags (this is what I 
 missed...)
 (Modify it properly...)

Although this is possible, most will recommend against it (including
me). This will create a JNDI resource that is available to all webapps
in your container. You probably only want it available to the webapp you
are currently using.

 Resource name=jdbc/akr_db auth=Container
   type=javax.sql.DataSource removeAbandoned=true
   removeAbandonedTimeout=30 maxActive=100
   maxIdle=30 maxWait=1 username=balazs
   password=12345
   driverClassName=com.mysql.jdbc.Driver
   url=jdbc:mysql://localhost:3306/akr_db/

You should move this to your context.xml file, and remove the
ResourceLink element from context.xml. Otherwise, keep these settings
the same.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGUusQ9CaO5/Lv0PARAmJlAKCMtg85QGBNtRsrKaBPcFoHeLxBlwCeL838
8cEGAm1lmvNQ6JidL65h5Cg=
=1LZQ
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]