Retrieve varchar column from Oracle query in a resulset

Hi, I'am a begginer in JSP Technologies.
I've do a small jsp that opens a db connection to an oracle, execute a query a show results.
When the columns of the query are int I've no problem, the jsp show the columns of the resulset, but when the columns selected are varchars the jsp doesn't show anything....
Can anyone help me?
Example:
Table: CUSTOMERS
Col1 : ID_COSTUMER int
Col2: CUSTOMER_NAME varchar
<%
Connection canal = null;
ResultSet tabla = null;
Statement instruccion=null;
try { Class.forName("oracle.jdbc.driver.OracleDriver");
canal=DriverManager.getConnection("jdbc:oracle:thin:@XXXXXXXXXXXXXXXXXXXp");
instruccion = canal.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
} catch(java.lang.ClassNotFoundException e){};
String Query = "SELECT ID_CUSTOMER FROM CUSTOMERS";
try { tabla = instruccion.executeQuery(Query);
out.println("<TABLE Border=10 CellPadding=5><TR>");
out.println("<TD>CUSTOMER</TD></TR>");
while(tabla.next()) {
out.println("<TR>");
out.println("<TD>"+tabla.getString(1)+"</TD>");
out.println("</TR>"); };
out.println("</TABLE></CENTER></DIV></HTML>");
tabla.close(); instruccion.close(); canal.close();}
catch(SQLException e) {};
%>Results:
CUSTOMER
1
2
3
4
Doing the change in query:
SELECT CUSTOMER_NAME FROM CUSTOMERS
I have not results....
Thank you.

sorry, I misplaced an ending code bracket on last one
I'm not really familiar with doing this inside a jsp.. but there are a few things that you should try to make sure that it isn't a database problem before assuming it is a problem on your jsp.... It is possible you have already tried the following but just to make sure.
When you do the second query does the first two out.printlns that are before the while still output? If not then your query is incorrect.
Second I would try
String Query = "SELECT ID_CUSTOMER,CUSTOMER_NAME FROM CUSTOMERS";
try { tabla = instruccion.executeQuery(Query);
out.println("<TABLE Border=10 CellPadding=5><TR>");
out.println("<TD>CUSTOMER_ID</TD><TD>CUSTOMER_NAME</TD></TR>");
while(tabla.next()) {
out.println("<TR>");
out.println("<TD>"+tabla.getString(1)+"</TD>");
out.println("<TD>"+tabla.getString(2)+"</TD>");
out.println("</TR>"); };
out.println("</TABLE></CENTER></DIV></HTML>");I suspect this will also return nothing.. if that is the case then you need to check your database. If it does infact return values for the ID and nothing for the NAME then I'm not sure at this point what the problem is.

Similar Messages

  • Multiple source columns from Oracle DB to Hyperion Essbase cube

    Hi Experts ,
    We have a Source as oracle table to the target Hyperion Essbase Cube(Planning) 11.1.2 using ODI 11g.
    Right now my issue is We need to map multiple columns from Oracle DB to One Dimension in Essbase (Planning).
    For example -> * In Oracle table i have columns as Name,Volume,unit and item *
    In Essbase the dimension called "*CatDefinition has lower level members as Name,Volume,unit and item * "
    Now using ODI ,* I want to map the oracle table columns(Multiple) to the dimension(Catdefinition) ? * Please suggest me with idea to achieve multiple column mapping to the single dimension in Essbase .
    Thanks in Advance !
    Keny Alex

    Do you even need FDM? You could build a load rule in Essbase directly. If you need to map, then you would register the Essbase target adapter.

  • HY000 error retrieving CLOB-data from oracle database via ODBC

    Hello,
    I get error HY000 [Oracle][ODBC][ORA] ORA-00932: inconsistent datatype when I want to show a CLOB column in my crystal report. The type of the field in the report is memo - in the database it is CLOB.
    How to retrieve CLOB-data from an Oracle 11GR2 database via ODBC in Crystal Report Version 12.3.0.601?
    Thanks in advance for any help.
    kind regards
    Monika Anna

    Hello,
    Who's ODBC driver are you using?
    Try our DataDirect drivers - https://smpdl.sap-ag.de/~sapidp/012002523100008666562008E/cr_datadirect53_win32.zip
    Thank you
    Don

  • Problems retreiving varchar attributs from oracle.sql.STRUCT

    Hi,
    I have downloaded the Java + Oracle Object Types examples from the oracle homepage, but instead of the varchar values from a STRUCT the Java-application just displays "???". Numbers and dates are displayed correct.
    Im running JDK1.4 on Windows and Oracle 9.2.0.8 on Unix with corresponding JDBC driver
    Any idea?
    Thanx in advance,
    Jo

    Jo,
    I'm guessing it has something to do with your NLS / I18N settings.
    Do you know what they are?
    Usually, both JDK and Oracle assume an American environment.
    In other words, American English, etc.
    Is your environment different to this?
    Good Luck,
    Avi.

  • I get error message each time I try to retrieve image (BLOB) from Oracle

    Can anyone help me?
    I am working with Servlet and JDBC with Oracle database. I can insert an image (GIF file) in a Oracle
    table in a BLOB field. But everytime I want to retrieve it
    I got an error "AbstractMethodError". My retrieve program (only the main part) is as below:
    String dbURL="jdbc:oracle:thin:@200.200.100.2:1521:tvm";
    String db_username="PROJ1"; String db_password="PROJ1";
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    }catch(ClassNotFoundException e1){ }
    try{
    Connection c=DriverManager.getConnection(dbURL,db_username,db_password);
    // Retrieving image file from database
    RandomAccessFile raf=new RandomAccessFile("//Davison/jakarta/webapps/examples/images/a10.gif","rw");
    PreparedStatement pstmt2=c.prepareStatement("Select fname,photo From testtable1 where fname=?");
    pstmt2.setString(1,"rere100");
    ResultSet rs=pstmt2.executeQuery();
    while(rs.next()){
    Blob blobImage=rs.getBlob("photo");
    int length=(int)blobImage.length();
    byte[] blobArray=blobImage.getBytes1,length);
    raf.write(blobArray);
    raf.close();
    Please help me soon, my email is: [email protected]
    Bye , Rea

    Probably a bit late, but I just got the same problem.
    Oracle seems to instantiate a class which is not fully defined-
    oracle.sql.BLOB. This class has abstract methods, and is therefore
    an abstract class.
    In short, Oracle are stupid fools. How they managed to instantiate
    an abstract class in the first place should be of concern to the
    Java gurus, however. Native code in the OCI driver perhaps?
    If you still need help, you could try uning the Thin driver- or
    a database with a JDBC driver which actually meets the spec. There
    are third party Oracle drivers which might fit the bill- they
    usually cost money, however.

  • Multiple columns from a query sorted vertically

    Is it possible to sort a query resultset vertically, with
    multiple columns across the page, in the following manner, with
    page breaks after 40 rows? I can get it to sort horizontally just
    fine with tables, but how can it be done vertically as shown?
    JONES, Abby JONES, Betty JONES, Dawn JONES, Frank
    JONES, Adam JONES, Bill JONES, Debbie JONES, Gayle
    JONES, Alice JONES, Bob JONES, Denton JONES, Henry
    JONES, Ben JONES, Cathy JONES, Emma JONES, John

    This will get you started. I assume you had the appropriate
    order by clause in your query. I also assume you want 4 columns per
    line.
    My approach would be to convert the query to an array and
    then output the array.
    columns = 4;
    maxrows = 40;
    recordsperpage = columns * rows;
    records = query.recordcount;
    myArray = ArrayNew(2);
    ThisColumn = 1;
    ThisRow = 1;
    if (records gt recordsperpage)
    LoopTill = recordsperpage;
    else
    LoopTill = records;
    for ( ii = 1; ii lte LoopTill; ii = ii + 1){
    myArray[ThisRow][ThisColumn] = query.field[ii];
    increment ThisRow;
    if (ThisRow = MaxRows + 1) {
    ThisRow = 1;
    increment ThisColumn;
    } // if
    } // looop
    You can do the rest

  • Retrieve the data from Oracle (Superior difficult)

    Dear all,
    I want to retrieve the data from the table (TABLE A), in TABLE A there are a field call RANGEFROM, However, the data type of it is "VARCHAR2". But in this field, it can contain numeric and date. Now, I want to select this field in it by a SQL statement. I want the SQL statement like this:
    "SELECT * FROM TABLE_A WHERE (to_date(RANGEFROM, 'mm-dd-yyyy')) <= 'Now()';"
    However, the result of the SQL only display in VARCHAR2 mode. That mean it can't compare the result. so What can I do?
    Thanks
    null

    As long as the input literal for formatting the date is in always like 'mm/dd/yyyy' then you may explicitly select the RANGEFROM field in your select list as to_date(RANGEFROM,'mm/dd/yyyy');
    eg:
    SQL> select to_date('01122000','mm/dd/yyyy') RANGEFROM from dual;
    RANGEFROM
    12-JAN-00
    Also this is now good for comparison:
    SQL> select SYSDATE - to_date('01122000','mm/dd/yyyy') from dual;
    SYSDATE-TO_DATE('01122000','MM/DD/YYYY')
    339.67455
    Also the same technique could be applied in your where condition as well.
    Good luck :
    (12 month wait for a response is not good)

  • To fetch Query Column from  a query .

    Is there a way to extract the column from a database to an application written in C / Proc* C

    Maybe this? You may get Name/Value pairs e.g. via
    michaels> select dbms_xmlgen.getxml ('select ename,job from emp where ename=upper(''scott'')') x from dual
    X                                                                                                                                                                                                      
    <?xml version="1.0"?>                                                                                                                                                                                  
    <ROWSET>                                                                                                                                                                                               
    <ROW>                                                                                                                                                                                                 
      <ENAME>SCOTT</ENAME>                                                                                                                                                                                 
      <JOB>ANALYST</JOB>                                                                                                                                                                                   
    </ROW>                                                                                                                                                                                                
    </ROWSET>

  • How to retrieve a BLOB from Oracle DB in Java 1,1

    I have a Blob in an Oracle DB that I want to retrieve and display as a .bmp in a COM component. Also I want to save the same blob to the DB later.
    Thanx in advance //Petter

    Hi,
    you can read a BLOB with the InputStream got from getBinaryStream() method of ResultSet class.
    You may write this stream out as a temporary file and pass it to your object. (I don't know how you communicate with COM).
    Best regards,
    Martin

  • Retrieve Filter Field from af:Query Component

    I'm using an af:query component on my form and have pre-definied ViewCriterias that load the page. Each ViewCriteria contains one field that is used across all of my search criterias....I need to be able to retrieve this field in my backing bean and get the value of it. I need to know what the user is searching on for this one particular field (i.e. which will always be available in the af:query. I have the queryListener pointing to a method in my backing bean...does someone have some sample code on how to access the fields used in the query and then access the value of one in particular?
    public void headerQueryListener(QueryEvent queryEvent) {
    CommonHelperFunctions.resolveMethodExpression("#{bindings.AllChangeOrdersQuery1.processQuery}",
    null, new Class[] {QueryEvent.class}, new Object[] {queryEvent});
    // What can I add here to retrieve a filter field and then retrieve it's value??
    The queryListener on my af:query component then calls this headerQueryListener in my backing bean.
    Thanks.

    I have tried the following code just messing around:
    QueryModel varQueryModel = getQueryHeader().getModel();
    List<AttributeDescriptor> attributeDescriptors = varQueryModel.getAttributes();
    AttributeDescriptor ad = attributeDescriptors.get(3);
    The attributeDescriptors has the information that I need. I can see the elements in my query and I can see that element 3 is the one I want, but it doesn't have the an _attrDef name but it does have an mAttrName and the mValues[0] mValue has the value that I'm looking for, but I'm having trouble figuring out how to access this information and retrieve what i actually need.  I'm very new to Java and ADF so sorry if this is a basic Java question, but if anyone could point me to an example or some sample code, I really appreciate it.
    Thanks in Advance.

  • Reference columns from another query

    I've made XML data template in Report Builder, which consists of multiple data queries and groups. When I use for each XML structure in Word template builder to obtain data, I get data only from one data query, and blanks for fields that I referenced from another group.
    Is there any way to solve that problem.
    Thanks in advanced for the answers.

    It seems to me that you are trying to get to a higher/parent element from within a lower/child group. So, use the ../ notation to get up to an element in a parent group. And add ../ as you go higher and higher. ex. <?../../CHECK_DATE?> Obviously, for referencing lower group, you just open the group with a for-each.
    Make it a habit to open and close your groups for ease of readability.
    Shree

  • Retrieve backend SQL from Oracle Financials Report

    Hi,
    There is a report set up in Oracle Financials (portal). This is running via a concurrent program, how can I view the backend SQL behind the report
    Can anyone help?
    p.s. I am using version 12
    Thanks

    Hi.
    In the System Administrator responsibility, query the report in the Concurrent Programs definitions and check the Enable Trace checkbox. Run the program. A trace file will be placed on your $ORACLE_HOME/admin/udump directory. Tkprof this trace file and open the output generated.
    Hope this helps.
    Octavio

  • "Error: Not able to connect to search service to retrieve valid settings" from CHange Query under search criteria

    Hi Everyone,
    I might made a big mistake by clicking Stop then Start action to "SharePoint Server Search" under  "Services on Server" from Central Administrator. Then all my search results have error messages. I did reset Index and start
    all crawls. It didn't work. Please Help.
    Thanks.
    Miranda
    Here is the picture under search page

    Hello Rk_muddala,
    I had a customer case where we got the same user friendly error in the Search Service Application of the Central Administration. When we looked at the ULS we got the following error:
    Exception in Query Builder OnLoad: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Attempted to perform an unauthorized operation.
    In our case it was because the user that was launching the Query Builder wasn't Administrator of the Search Service Application. Overhere is an Technet article how you can add an administrator:
    http://technet.microsoft.com/en-us/library/ee704546(v=office.15).aspx 
    - Dennis | Netherlands | Blog |
    Twitter

  • Unable to retrieve CLOB data from oracle

    hello I am trying to retreive a clob data from database. I am passing "country" to get "information". after submitting data it is showing SQLException caught: General error .
    whatz wrong.? can anybody help?
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class ClobTest2 extends HttpServlet{
         public void doGet( HttpServletRequest req, HttpServletResponse res )
              throws ServletException, IOException
                   Connection conn = null;
                   Statement st = null;
                   ResultSet rs = null;
                   res.setContentType( "text/html" );
                   PrintWriter out = res.getWriter();
                   String coun$ = "";
                   coun$ = req.getParameter( "coun" );
                   try{
                      Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver");
                      conn = DriverManager.getConnection( "jdbc:odbc:clobtester",    "temp", "sol" );
                      st = conn.createStatement();
                      rs = st.executeQuery( "SELECT information FROM testclob WHERE country = '"+coun$+"' ");
                        while( rs.next() )
                         out.println(rs.getClob(1) );
                      catch( ClassNotFoundException e )
                           out.println( "Could not load database driver" + e.getMessage() );
                      catch( SQLException e )
                           out.println("SQLException caught: " + e.getMessage()  );
                    e.printStackTrace();
                   catch( Exception e )
                       System.err.println( "Problem closing the database" );
                 try{
                             st.close();
                             conn.close();
                         }catch( Exception e )
                            System.err.println( "Problem closing the database" );
         }

    certainly but this problem can go on several
    category. and I am the needy one to get the solutionHowever I don't need to answer cross-posted questions. And I don't.

  • Not able to retrieve order number from Oracle Apps

    Hi,
    We created a BPEL process to create order in Oracle Applications. We are calling a wrapper procedure which in turns calls pre-seeded API to creating an order using Oracle Applications Adapter. The Order is been creating in Oracle Applications but we are not able to get the Order number in return to the BPEL Process.
    Is there any configuration or setup to be done?. Can any one help out in this regard.
    Thanks in advance.
    Regards,
    Rami

    user11996936 wrote:
    Has anyone faced such an issue with Oracle Apps?Maybe. Maybe not. Ask to the proper forum. Here you are in Peoplesoft forum.
    Nicolas.

Maybe you are looking for

  • Sing&Certify in Reader 9??

    Hello. Is it possible to sign & certify a form in Reader 9? Because i can't do it.. (i can in Acrobat). I extended features in Reader. Please help. thnx.

  • Automatically sign in

    Hi I have a requirement that when in a user email, there would be a hyperlink which would automatically login in to a web portal. The user will not be promted for a password. So whats the design alike.

  • All my songs and pictures are not transferring from my old phone !!!!!!

    I had the iphone 4S and yesterday I went and got the iphone 5. I am trying to transfer everything using my icloud. All my apps,notes,txt msgs,contacts... everything like that was added onto my new phone. My pictures & music however, are still all add

  • Oracle 9i Problem when using multicolumn bulk update with "save exceptions"

    I'm running into a problem with Oracle 9i when running a multicolumn update with "save exceptions". The problem occurs when updating 4 or more fileds. (The data being updated are 40 character text strings) I'm updating 1000 records at a time, in bulk

  • Why does Firefox tend to stop responding

    Almost on a daily basis Firefox stops responding out of nowhere. At first I reckoned it might be my installed add-ons, that were poorly written, that screwed up the system. After disabling them the problem kept reoccuring. It tends to run really slug