What is the most "database independent" way of creating a variable length text field in a database

Posted by Thibaut Colar on Stack Overflow See other posts from Stack Overflow or by Thibaut Colar
Published on 2010-05-25T18:32:58Z Indexed on 2010/05/25 19:01 UTC
Read the original article Hit count: 157

Filed under:
|
|

I want to create a text field in the database, with no specific size (it will store text of length unknown in some case) - the particular text are serialized simple object (~ JSON)

What is the most database independent way to do this : - a varchar with no size specified (don't think all db support this) - a 'text' field, this seems to be common, but I don't believe it's a standard - a blob or other object of that kind ? - a varchar of a a very large size (that's inefficient and wastes disk space probably) - Other ?

I'm using JDBC, but I'd like to use something that is supported in most DB (oracle, mysql, postgresql, derby, HSQL, H2 etc...)

Thanks.

© Stack Overflow or respective owner

Related posts about sql

Related posts about database