Thursday, August 04, 2005

Connection Pooling with Tomcat

I finally got pooled connections to both MS SQL and Sybase. For something that you would think would be straight forward, it's not. Some of what I encountered:


ResourceParams don't work. All the documentation I found about connection pooling says that you should define your pool as such:

<Resource name=".....">
<ResourceParams name="***same as above***">
various <parameter> tags here

This doesn't seem to work. Instead, you dump all the parameters for the resource into the resource element. OK, I haven't been using Tomcat for long, but splitting the resource's parameters away from the resource they parameterize seems a bit odd anyway, so I'm not that bothered by this. If I get some free time I should try a connection to MySQL with ResourceParams and see if that works, as what seems like 75% of the example out there use MySQL (the rest is mostly Oracle) and they all use ResouceParams.


As several apps on the same web server are going to use the Sybase connection, I wanted to use the main server.xml to hold it. I used the admin app (which of itself was another joy to get up and running, as the doc's say you need to install it separately, but don't bother to point out where you get it) to insert the resource into server.xml. However, even though the resource was placed into server.xml, it didn't work - I had to place the resource in the conf/catalina/localhost/XXXXX.xml file (replace XXXXX with the name of the app) and it did work. But as I actually do want that resource to be server wide, I'm going to have to play around with getting it to work.

"application name".xml

That XXXXX.xml file I mentioned above has a habit of getting overwritten. It gets rewritten when you redeploy the war file (which is not that surprising), but it also seems to get blanked out at other times (perhaps when the server is restarted). I'm hoping there's some way to get it to stay with the content I want. I suspect the contents of context.xml get placed in their, but I'm not sure - I had been playing with putting the resources in context.xml earlier in the day, but that didn't work - however that was when I was still trying to use ResourceParams, so I will try it again with just Resource elements.


What's really getting me is how undocumented it all seems. Even the book I have on Tomcat 5 (Professional Apache Tomcat 5) doesn't go into any great depth on the subject - in fact it seems to be little more than what's already in the Apache Docs.

Friday, February 11, 2005

Upflickr 0.1 released

I've released version 0.1 of upflickr, a command line uploading tool for flickr. It can be found here.

It's a bit rough when it comes to installing, as in it's just the source code (but as it's a python script it's runnable straight from source). And there's some other stuff I want it to get it to do, but it is at least in some form of state to show the world.