Stephen's Statements A little bit of everything from Stephen Duncan Jr, a Programmer/Web Geek working in the defense industry

Tuesday, July 20, 2004

Troubleshooting Stupid Problems

I hate spending a whole day trouble-shooting something, only to find that the problem was something little and dumb.

In this case, I was trying to set up an Oracle connection in Tomcat 5.0 (using the ojdbc14.jar thin Oracle JDBC driver) as a DataSource for access via JNDI. As you can guess from all that, there's plenty of places for things to go wrong. The configuration for all this is stored in an XML file. I tried all sorts of things to fix this. Capitalization of the named parameters, the driver name, the factory name, everything.

What did the problem turn out to be? A $. The password for the account I was using to connect to the database conatined a dollar sign. I got the password changed to something not using a $ sign, and everything suddenly worked.

Now, for any smart people out there: is this an XML issue? Is $ a special character? Does it need escaping? (Already faced that issue with an ampersand that needed escaping). Or is it a Tomcat specific issue? I'm pretty sure it's not an Oracle specific issue, at it seems to break the MySQL driver too, plus the connection worked fine if made straight from Java code.

Labels:

Comments:

It's not an XML issue. The $ has no special meaning in XML. It's just &, <, and > that you really have to watch out for with XML.

I couldn't tell you if it was related to Tomcat or Oracle though, although I think Oracle should support $ in the password no problem. It might be the JDBC driver internally using the $ as some sort of terminator and thus giving you problems.

If you ever find out, I'd be curious to know where the problem was with the $. Undocumented bugs like that are annoying, for sure.

Yeah, I was pretty sure it wasn't XML, and checked around on that already.

I'm also pretty certain it's not the driver, because, like I said, it works fine making a connection straight from the code. It's got to be a Tomcat thing. I'll try to look into it some more later, maybe post to the appropriate Tomcat mailing list.

From what I've read out there it is a Tomcat 5.0.X configuration issue. And yes, I spent sometime on it as well.

Post a Comment