tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Casting a Connection as an OracleConnection in Tomcat 7
Date Fri, 02 Dec 2011 21:19:41 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jason,

On 12/2/11 3:54 PM, Jason Perrone wrote:
> Yep, screw casting as an Oracle connection.

That would be my recommendation. People used to cast to
OracleConnection because JDBC didn't have support for LOB types way
back in the day. Some old online HOWTO must have been the meeting
place for Google searchers to "discover" that great hint to make your
life into a living hell by using underlying connections when it's not
necessary.

> Just do this:
> 
> session.beginTransaction(); PreparedStatement st =
> session.connection().prepareStatement("alter session set
> TIME_ZONE='" + timeZone.getID() + "'");

If you're going to use a PreparedStatement, you may as well actually
used the parametric replacement that it offers. :)

> Thanks Christopher, for getting me to think outside the box :)

I just think inside a different box.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7ZQO0ACgkQ9CaO5/Lv0PDDgQCdEkkWqfO7QC/zGxeV644EjE3U
iGoAn3XtoIX93+3+uoCs97mP08MhBtQ3
=L1fD
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message