What is the most "database independent" way of creating a variable length text field in a database
- by Thibaut Colar
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.