Source for Packages org.apache.tomcat.dbcp and below?

2006-09-12 Thread Mark Barnes
I have downloaded the 5.5.17 source, and am looking for the source for class 
org.apache.tomcat.dbcp.dbcp.BasicDataSource but cannot find it.  In fact, I 
cannot find org.apache.tomcat.dbcp.


Can someone please point me to where it is?

I've also looked under Jakarta Commons but can't seem to find it there either. 
I seem to be able to find only org.apache.commons.dbcp.BasicDataSource.  But 
that's not the kind of DataSource return via JNDI from Tomcat.



Thanks,
---Mark

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



Re: Source for Packages org.apache.tomcat.dbcp and below?

2006-09-12 Thread Mark Barnes

Yoav -

Thanks for responding.


"re-packaged"?   Does that mean "wrapped"?


It has a different package structure than that in Jakarta Commons DBCP.
   org.apache.tomcat.dbcp.dbcp.BasicDataSource
vs
   org.apache.commons.dbcp.BasicDataSource


How are these related?  By extension?  By wrapping?  Do I cast one of these to:
   org.apache.tomcat.dbcp.dbcp.BasicDataSource
or can I cast it to:
   org.apache.commons.dbcp.BasicDataSource


I can find org.apache.tomcat.dbcp.dbcp.BasicDataSource in the jar files.  I 
cannot find org.apache.commons.dbcp.BasicDataSource in the jar files.



I'm trying to figure out why I cannot get Application-managed DataSource 
(auth=Application) to work.  I want to look at the source code to investigate. 
I was also trying to cast the DataSource returned by JNDI so I can query its 
properties.  Casting to org.apache.tomcat.dbcp.dbcp.BasicDataSource doesn't seem 
to work, resulting in a "package does not exist" even after including the jar 
file in the CLASSPATH.



Thanks!
---Mark


Yoav Shapira wrote:

org.apache.tomcat.dbcp should be just a repackaged Jakarta Commons
DBCP, with no code changes.  The data source you get back from
Tomcat's JNDI by default is just that repackaged one, which of course
implements the standard javax.sql.DataSource interface.

Yoav

On 9/12/06, Mark Barnes <[EMAIL PROTECTED]> wrote:
I have downloaded the 5.5.17 source, and am looking for the source for 
class
org.apache.tomcat.dbcp.dbcp.BasicDataSource but cannot find it.  In 
fact, I

cannot find org.apache.tomcat.dbcp.

Can someone please point me to where it is?

I've also looked under Jakarta Commons but can't seem to find it there 
either.
I seem to be able to find only 
org.apache.commons.dbcp.BasicDataSource.  But

that's not the kind of DataSource return via JNDI from Tomcat.


Thanks,
---Mark

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




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



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



Re: Source for Packages org.apache.tomcat.dbcp and below?

2006-09-12 Thread Mark Barnes

Thanks.  I really appreciate your input.



Yoav Shapira wrote:

Hi,


"re-packaged"?   Does that mean "wrapped"?


No, it just means the package names are changed, from
org.apache.commons.dbcp to org.apache.tomcat.dbcp.

  .
  .
  .
I was also trying to cast the DataSource returned by JNDI so I can 
query its
properties.  Casting to org.apache.tomcat.dbcp.dbcp.BasicDataSource 
doesn't seem
to work, resulting in a "package does not exist" even after including 
the jar

file in the CLASSPATH.


Really, that casting doesn't seem to work?  I would expect it to...
Maybe you have an extra
.dbcp. in the package name above?



Actually, the problem with the cast was I had a typo in the path for the jar 
file when I added it to the CLASSPATH.  I can get it to compile now.




But back to my original question:

Where is the actual source to this "re-packaged" class???  I cannot find it in 
the downloaded source tree.


Which version of commons.dbcp was re-packaged?

If I look at the commons.dbcp source can I be absolutely sure it's the same 
version of the class in the jar file?




Thanks again.

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



Re: Source for Packages org.apache.tomcat.dbcp and below?

2006-09-12 Thread Mark Barnes

Remy Maucherat wrote:

Mark Barnes wrote:

But back to my original question:

Where is the actual source to this "re-packaged" class???  I cannot 
find it in the downloaded source tree.


Which version of commons.dbcp was re-packaged?

If I look at the commons.dbcp source can I be absolutely sure it's the 
same version of the class in the jar file?


The source in that case is the build script (and looking at which 
versions are used doesn't hurt, of course).




Okay, I see that this re-packaging is done on the fly during tomcat build.

So how do I find the correct source of commons.dbcp from when tomcat 5.5.17 was 
built?


I look at the current (1.2.1) DBCP source, and it looks like it cannot possibly 
be what tomcat 5.5.17 is using.  If my code were to call the 1.2.1 version of 
method...


BasicDataSource.getConnection(String username, String password)

...I would expect to get an UnsupportedOperationException from class 
PoolingDataSource.  It's not the outcome I would have hoped for, but at least it 
makes it seem someone has at least noted the problem I am having and has written 
a "fix" for it, of sorts, making the method unsupported.  What I am seeing 
instead is an error from the database complaining about an invalid 
username/password.  The username and password being passed into getConnection() 
obviously are not being used.


Apparently, Application-managed DataSource authorization (auth=Application) is 
not implemented in Tomcat.  But I guess I can try the fallback of setting the 
username and password properties instead for the BasicDataSource, but to do it I 
must cast to BasicDataSource.  So much for write-once-run-anywhere.



Thanks again for your comments.

---Mark

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



Re: Source for Packages org.apache.tomcat.dbcp and below?

2006-09-13 Thread Mark Barnes

Yoav Shapira wrote:

Hi,
One more thing:


On 9/12/06, Mark Barnes <[EMAIL PROTECTED]> wrote:
I look at the current (1.2.1) DBCP source, and it looks like it cannot 
possibly
be what tomcat 5.5.17 is using.  If my code were to call the 1.2.1 
version of

method...

 BasicDataSource.getConnection(String username, String password)

...I would expect to get an UnsupportedOperationException from class
PoolingDataSource.  It's not the outcome I would have hoped for, but 
at least it
makes it seem someone has at least noted the problem I am having and 
has written

a "fix" for it, of sorts, making the method unsupported.


No, you're misreading something here.  The JavaDocs on the web site
are for the 1.2.2 (or 1.3, whatever the DBCP committers decided to
call it) release.  They reflect changes made in SVN to throw these
exceptions, probably in response to JIRA issue DBCP-36 which sounds
similar to yours.  In DBCP 1.2.1, these methods do not throw
UnsupportedOperationExceptions, nor are they documented to throw these
exceptions.



Hi, Yoav -


I guess I really *am* confused now.

Below is the code from PoolingDataSource.java from the 1.2.1 source tree I 
downloaded.  I read the code for BasicDataSource method createDataSource(), and 
I can see that BasicDataSource delegates to a PoolingDataSource, whose method 
does indeed throw UnsupportedOperationException, as seen in the JavaDocs and in 
the code below:


/**
 * Throws [EMAIL PROTECTED] UnsupportedOperationException}
 * @throws UnsupportedOperationException
 */
public Connection getConnection(String uname, String passwd) throws 
SQLException {

throw new UnsupportedOperationException();
}


Here's the code for geConnection(String,String) from BasicDataSource.java:

public Connection getConnection(String username, String password) throws 
SQLException {

return createDataSource().getConnection(username, password);
}



Here's the code for createDataSource() from BasicDataSource.java, where the 
delegate is created:


// Create and return the pooling data source to manage the connections
dataSource = new PoolingDataSource(connectionPool);


Maybe I'm missing somewhere in the DBCP source where the 
UnsupportedOperationException is caught and silently ignored???  I can't see it.


Or is it possible that the source I downloaded isn't really for release 1.2.1 
even though the download page says it is, and even though the name of the 
directory created when un-zipping has "1.2.1" in it.



---Mark

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