Subject Re: [Firebird-Java] Re: very stupid error wtih firebird jdbc driver
Author Mark Rotteveel
Why are you using a CHAR or VARCHAR and not an INTEGER as the column
type (as it looks like you are storing a numeric value), and why is the
contents of that column left-padded with spaces?

My advise: change your datamodel and use INTEGER as a datatype and not a
CHAR/VARCHAR, and otherwise use UPDATE <table> SET <columnname> =
TRIM(<columnname>) to remove the padding.

If you can't you might want to consider using TRIM(<columnname>) = ? in
your query (although then you will need to use a function-index).

Mark

PS Your solution below may work, but it is kind of a kludge.

fred.vlietstra wrote:
> I have solved the problem.
>
> You must provide the field with trailing spaces.
>
> example I will get the "lidnr" 100 the field must have trailing spaces.
> " 100".
> So I must add the follwing shit to my class :
>
> int len = lidNr.length();
> String id = null;
> switch (len)
> {
> case 1: id = " " + lidNr;
> break;
> case 2: id = " " + lidNr;
> break;
> case 3: id = " " + lidNr;
> break;
> case 4: id = " " + lidNr;
> break;
> case 5: id = " " + lidNr;
> break;
> case 6: id = " " + lidNr;
> break;
> case 7: id = " " + lidNr;
> break;
> case 8: id = " " + lidNr;
> break;
> case 9: id = " " + lidNr;
> break;
> case 10: id = lidNr;
> break;
>
> }
> stmt.setString(++x, id);
>
> But it works.



--
Mark Rotteveel <Avalanche1979@...>