Are you retrieving the column value via a named column or
via a column index ?
JDBC documentation recommands to used the second approch.

If your request looks like following :

    select your_table.col1, your_table.col2, your_table.col3
    from your_table;

The appropriate way (more portable) to retrieve your result is

    result.getString( 1 );  // for col1
    result.getString( 2 );  // for col2
    result.getString( 3 );  // for col3

The other way that uses column name to access result :

    result.getString( "col1" );
    result.getString( "col2" );
    result.getString( "col3" );

may be not portable with all JDBC drivers.
Some drivers will expect the following full syntax :

    result.getString( "your_table.col1" );
    result.getString( "your_table.col2" );
    result.getString( "your_table.col3" );


Please note that the syntax :

    like '<rowvalue>'

is not safe anymore...

You should use a prepared statement :

    select <rowname> from <table> where <rowname> like ?

And then set a request parameter for the like filter...


Hope this helps


nicolas germain
akazi technologies - france
[EMAIL PROTECTED]


-----Message d'origine-----
De : Srinivasan S (Systems Engineering Group) <[EMAIL PROTECTED]>
� : [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date : mardi 20 juillet 1999 15:14
Objet : A unique problem.


|        Hi people,
|
|        I got a unique problem in my JDBC stuff.  I can able to
|        select all the values from the table using
|        select * from table and it is displaying me the value i am
|        expecting.  But when i select i look out for a particular value
|        it is saying me column not found but the same column is getting
|        selected when i say *.
|
|        the syntax for the column is that
|
|        select <rowname> from <table> where <rowname> like '<rowvalue>'
|
|        where i am going wrong??  Has anybody come across these kind
|        of errors if so how it is solved.  Please help me despite the
|        fact that this is a servlet forum i am pasting this question
|        forgive me for my trespassing and please help me.
|
|Thanks
|Srini
|
|  #-----------------------------------------------------------------------#
|  #                                                                       #
|  #     "It is better to remain silent and be thought a fool than to      #
|  #            open one's mouth and remove all doubt."                    #
|  #                                                                       #
|  #                     [EMAIL PROTECTED]                          #
|  #-----------------------------------------------------------------------#
|
|___________________________________________________________________________
|To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
|of the message "signoff SERVLET-INTEREST".
|
|Archives: http://archives.java.sun.com/archives/servlet-interest.html
|Resources: http://java.sun.com/products/servlet/external-resources.html
|LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
|

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to