Subject Re: very stupid error wtih firebird jdbc driver
Author fred.vlietstra
Hello Mark,

The trim option works fine. Thank you


--- In Firebird-Java@yahoogroups.com, "Fred Vlietstra"
<fred.vlietstra@...> wrote:
>
> Hello Mark,
>
>
>
> You are right but this is an existing database I cannot change the
> datamodel.
>
>
>
> I shall try your solution. The solution I made is a really a
kludge.
>
>
>
>
>
> Fred
>
> _____
>
> Van: Firebird-Java@yahoogroups.com [mailto:Firebird-
Java@yahoogroups.com]
> Namens Mark Rotteveel
> Verzonden: dinsdag 17 februari 2009 18:08
> Aan: Firebird-Java@yahoogroups.com
> Onderwerp: Re: [Firebird-Java] Re: very stupid error wtih firebird
jdbc
> driver
>
>
>
> 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@ <mailto:Avalanche1979%40gmx.net>
gmx.net>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>