× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Rajesh,

If '6E12  BYD30' is the actual value you're looking for (and not just
something you typed in order to post your question) then this is 11 chars
long so will never be found in a length 10 field...?  Are you sure you're
putting the same number of spaces in when you test the query in an SQL
interactive session?  Does it behave the same using both the toolbox &
native JDBC drivers?

Incedentally, in my experience, trailing blanks don't cause a problem.  If
you have say a length 10 char field, and put 'ABC' in it, then the iSeries
database pads this out with 7 spaces.  However when you access the field
through JDBC, it will trim the trailing spaces back off again, and so WHERE
field = 'ABC' does correctly find the value.  (This does however mean that
if you write 'ABC ' into the field, the trailing space is lost).

Regards,

Nigel Gay.


java400-l-bounces@xxxxxxxxxxxx wrote on 16/05/2006 12:17:34:

>    It works fine on iSeries SQL interactive session but doesn't
> work from Java app.
>
>    And I get...
>
>    SELECT firm,office, acct FROM Table WHERE ref = '6E12  BYD30'.
>
>    Incidentally, the database file has field ref as 10 char long
> and not varchar.
>
>    I can't change the db table because of much wider implications.
>
>    rgds,
>
> Rajesh Anand
> Email:Rajesh_anand@xxxxxx
>
>
> -----Original Message-----
> From: java400-l-bounces@xxxxxxxxxxxx
> [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Narayanan R Pillai
> Sent: 16 May 2006 15:34
> To: Java Programming on and around the iSeries / AS400
> Subject: Re: Selection a row using jdbc where a column contains embedded
> blankson iSeries.
>
>
> Anand,
>
> If you do a System.out.println( sqlstmt ) in your app, cut and paste
> that in  the SQL  command line, what do you get ?
>
> Pillai
>
> Anand, Rajesh wrote:
>
> >All,
> >
> >   I've encountered a problem and hoping someone in the list have
> >come across this.
> >
> >   I've a database file on iSeries and one of the column has data
> >like "abc__d00" where "_" represents a blank.
> >
> >   This column has 2 blanks and when using jdbc sql statement like
> >below..the resultset does not returns this row.
> >
> >   String sqlstmt = "select    firm, office, acct from Table
> >where Ref  = "  + "'" +wrkref.trim() + "'" ;
> >
> >   wrkref (String ) varaible contains the value = abc__d00.
> >
> >   WHY doesn't the jdbc returns this row. I know it exists but
> >wondering if its to do with wrkref defined as String type and nulls in
> >the string type do not convert to
> >   characters in jdbc.
> >
> >   Any help will be greatly appreciated.
> >
> >
> >
> >Rajesh Anand
> >Email:Rajesh_anand@xxxxxx
> >--------------------------------------------------------
> >
> >If you are not an intended recipient of this e-mail, please notify the
> sender, delete it and do not read, act upon, print, disclose, copy,
> retain or redistribute it. Click here for important additional terms
> relating to this e-mail.     http://www.ml.com/email_terms/
> >--------------------------------------------------------
> >
> >
>
> --
> This is the Java Programming on and around the iSeries / AS400
> (JAVA400-L) mailing list
> To post a message email: JAVA400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/java400-l
> or email: JAVA400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/java400-l.
>
>
> --
> This is the Java Programming on and around the iSeries / AS400
> (JAVA400-L) mailing list
> To post a message email: JAVA400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/java400-l
> or email: JAVA400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/java400-l.
>



********************************************************************************
The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee; access to this
email by anyone else is unauthorised.

If you are not the intended recipient: (1) you are kindly requested
to return a copy of this message to the sender indicating that you
have received it in error, and to destroy the received copy; and (2)
any disclosure or distribution of this message, as well as any action
taken or omitted to be taken in reliance on its content, is prohibited
and may be unlawful.
********************************************************************************


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.