List:MySQL and Java« Previous MessageNext Message »
From:Mark Matthews Date:July 11 2002 4:22pm
Subject:Re: No boolean or true/false type in MySQL?
View as plain text  
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Brian Szabo wrote:
| I can't find any documented boolean type of datafield in MySQL.   Is
| this correct?  If so, that seems to be a major drawback.  I know you
| can
| easily fake it yourself, but I am just trying to convert some existing
| jsp pages to use MySQL, now I have to change all of my sql statements
| as
| well as connection strings.  If I just overlooked how to do this
| please
| let me know so I don't waste my time.
|
| Thanks,
|

MySQL does have the BIT type (which is really a TINYINT). The JDBC
driver will convert for you, if you use PreparedStatement.setBoolean()
and ResultSet.getBoolean().

I really recommend using either a persistence broker like Object
Relational Bridge to hide database differences and schema changes or if
that's not possible, using PreparedStatements wherever you can, as it
takes a lot of the headache out of conversions, because most drivers and
persistence brokers will do the type/syntax conversions for you.

	-Mark



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

iD8DBQE9LbC4lyjUJM+7nP4RAnQmAJsFnI1kXnyPOYbPJhbv1VzSk7d8ogCgiUnc
X+xnWytr9G1MOtCdgRNQRg4=
=Jssn
-----END PGP SIGNATURE-----

Thread
No boolean or true/false type in MySQL?Brian Szabo11 Jul
  • RE: No boolean or true/false type in MySQL?Admin11 Jul
  • Re: No boolean or true/false type in MySQL?Mark Matthews11 Jul
  • Re: No boolean or true/false type in MySQL?Claus P. Priese6 Sep