List:MySQL and Java« Previous MessageNext Message »
From:Christian Mack Date:May 10 1999 4:06pm
Subject:Re: long varchar equivalent in mySql?
View as plain text  
Mark Muday wrote:
> Is there a type in mySql that is the equivalent of long varchar?
> I see that there are TEXT, MEDIUMTEXT and LONGTEXT types...
> if these are the equivalent of long varchar, am I able though JDBC to
> 1) get the value of a LONGTEXT column using getString() ?
> 2) insert values into a LONGTEXT column using a regular Statement?  Or do I
> have to use a Prepared Statement?
> Thanks loads and bundles,
> -Mark Muday

Hi Mark

Using getString() works fine.
Inserting with a normal Query works fine too, as long as you escape all 'special'
characters (or don't use them at all).

'special' characters are:  '  "  \  0x00
They should be escaped to: \' \" \\ \0

The PreparedStatement will do the escaping of 'special' characters for you if you use the
setBytes() method.
Normally you only need it for byte arrays like images or such.

If you have big Strings, don't forget to set the setMaxFieldSize(int max) on the Statement
while getting them out and look at the MAX_ALLOWED_PACKET on the mysql server when


long varchar equivalent in mySql?Mark Muday9 May
  • Re: long varchar equivalent in mySql?Christian Mack10 May