db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Morton <djmorto...@yahoo.com>
Subject Re: how to find programatically the max size of a column?
Date Fri, 21 Jul 2006 17:56:56 GMT
If you run the getColumns(...) method of a
DatabaseMetaData object, you get a result set with all
the columns in the specified table.  The 7th field in
the each row of the result set is the max number of
characters allowed if the corresponding column is a
text field.  

For more info, look at:

http://java.sun.com/j2se/1.5.0/docs/api/java/sql/DatabaseMetaData.html#getColumns(java.lang.String,
java.lang.String, java.lang.String, java.lang.String)


Dan Morton


--- pierre madiot <pitonew@yahoo.fr> wrote:

> Hello,
> 
> I have to design a webapp form which would display
> an
> error message when a <textarea>'s content is beyond
> the maximum size of the back-end Derby's table's
> column.
> 
> The user may at install time choose the size of the
> VARCHAR column.
> 
> in the context of the MVC i'd like to have the C to
> through an error to the V, when it finds out that
> the
> field content sent from the form is larger than the
> maximal acceptable from the M.
> 
> i'd like to be able to use the jdbc DatabaseMetaData
> API to find out the information dynamically. 
> I wasn't able to find how how so far.
> 
> Ideally, i'd like to find a DB independant way to
> retireve this info. I realise this is Derby focus
> list, but our deployment targets 2 other major DBs
> for
> now (MySQL and Oracle... would you have guess :).
> 
> anyway, thanks for all helps and hints on this.
> 
> cheers
> 
> 
> 	
> 
> 	
> 		
>
___________________________________________________________________________
> 
> Découvrez un nouveau moyen de poser toutes vos
> questions quelque soit le sujet ! 
> Yahoo! Questions/Réponses pour partager vos
> connaissances, vos opinions et vos expériences. 
> http://fr.answers.yahoo.com 
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Mime
View raw message