On Thu, 28 Jan 2010, Simon Temple wrote:
> ParameterMetaData m = stat.getParameterMetaData( );
> int colWidth = m.getPrecision( parameterIndex );
>
> For varchar columns I would expect to get the maximum column width. So 8
> for a varchar(8).
>
> I always get zero as a result.
>
This is the best the JDBC driver can do. When preparing a statement, the
server only returns the datatypes, not additional details about the size.
This is because the parameters do not always match up with a table column.
Consider "WHERE replace(col, 'a', 'bb') = ?" you won't be able to tell
the parameter size from that.
Kris Jurka