ResultSet.getString() returns only 2000 characters

Hi
I am using the JDBC (1.0 API) thin client version with Oracle 8.0.6 and one of my table columns uses the datatype VARCHAR2(4000). When inserting, I can insert values correctly but when I read values from this column (using rs.getString("col_name") or rs.getAsciiStream("col_name")), i can only read the first 2000 characters. How can I read all the data in the column...
thanks,
-aravind
(i can view all the data when I use Delphi SQL-Explorer so I know that the data has been entered correctly)

Hello Argyn,
I have a similar problem with you but with Greek characters.
Try this:
When you write into oracle use:
conn.statement.executeQuery("insert into testlang (Text_1) values (" + new String(sS.getBytes(),"UTF-8") + "')");
When you read from oracle use:
String sS = new String(resultSet.getBytes(i), "XXXX");
Where XXXX is the encode character set that you want.
(Note: getBytes work only if your ResultSet is not Scrollable)
Please let me know if this help you.
Piperis
My problem is that I want to store Greek Characters in a way that I can read them via sqlplus too.
By encoding when I write and decode them when I read doesn't satisfy me... any help!!!

Similar Messages

  • ResultSet.getString() returning null.

    I'm using a PreparedStatement to select 1 row/10 columns from a
    table. The first time I getXXX() my values all is fine. I close
    the result set, clear the parameters and set the one variable on
    the statement and executeQuery. I can now read about 3 getXXX()
    and then the remaining getString() calls return null.
    The problem occurs when using the 1.1.1 thin driver but NOT when
    using an jdbcodbc driver.
    Any thoughts?
    Thanks, Frank
    PS: Please respond to my email address of [email protected]
    as well.
    null

    I believe there is/was a bug where once a NULL column value was
    retrieved, it would corrupt the ResultSet data (i.e. you will get
    NULL from then on). Not sure if this was resolved in a driver
    patch yet or not. Try downloading the latest version of the THIN
    driver.
    null

  • How to get all records using Invoke-webrequest?/Why Invoke-webrequest returns only first 2000 Records?

    invoke-webrequest content returning only 2000 records though it has around 4000 records in web api.
    The same url if I give in excel oData Data feed I am getting all the records.
    See the below script
    Script:
    $QueryResult= (Invoke-WebRequest -Uri $ODataURI -UseDefaultCredentials)
    [xml]$xmlResult=$QueryResult.content
    foreach($obj in $xmlResult.feed.entry.content.properties)
    $Name=$obj.Name;
    $IsAvail=$obj.isAvail.'#text';
    $PGroup=$obj.PGroup
    I am exporting the above result as a CSV file and my CSV file contains only 2000 records. 
    But,  $xmlResult.feed.Count --> it Shows 4000 Records.
    The same Odata url if I give in excel oData Data feed I am getting all the 4000 records.
    So Please help me how can I get all the records using power shell.
    Thanks
    A Pathfinder..
    JoSwa
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"
    Best Online Journal

    Hi Jo Swa(K.P.Elayaraja)-MCP,
    Would you please also post code which is used to export the records?
    In addition, to use the cmdlet invoke-RestMethod to work on ODate feeds, please refer to this article:
    Interacting with TechEd NA 2012 Schedule using PowerShell v3
    I hope this helps.

  • GetNodeValue return only 4096 car. !!!!!!!!!!!

    Hello,
    We have migrate to Oracle Server 8.1.6, PLXML parser 1.0.2 with Java XML parser 2.0.2.8 and we have the SAME limitation in PLSQL :
    theChildValue := Xmldom.getNodeValue(XMLdom.getfirstchild(theChildNode));
    return only 4096 characters !!
    WHAT COULD WE DO ???! PLEASE HELP !
    is it a bug or ??
    thanks

    The problem is in plxmlparser_v1_0_2/lib/xmldocumentcover.sql
    (kkarun, are you there ? )
    there, you can read that the PLSQL wrapper
    of the underlying java classes are all using
    VARCHAR2 and not CLOB as object type.
    Since VARCHAR2 in PLSQL has the notorious 4K limit, then ... this is what you get.
    I am trying out now to write my own PLSQL
    wrappers for the entire xmldom package so that CLOBs be allowed as underlying data types.
    I have tested, infact, and java.lang.String
    which is used "for doing the job" has no limit (beyond the amount of total memory given to the JVM and then the maximal 512MB
    memory that at all can be allocated to the heap ) on how big a String can be.
    Therefore, I feel that the problem be simply due to the PLSQL wrappers of the xmldom which
    are set to VARCHAR2 instead of CLOB or BLOB.
    I would appreciate as well your point of view
    null

  • How is ResultSet.getString() SUPPOSED to return BINARY types?

    Hello All:
    I got a legacy code to support. The code uses ResultSet.getString() to retrieve BINARY data. ORACLE JDBC driver converts binary data to their hexadecimal representation. It also behaves "correctly" in this sense when I use setString() on prepared statement for BINARY field: it converts valid hexadecimal strings to binary data and rejects strings which contains non-HEX digit characters with SQLException (btw if I give it an odd number of hexadecimal digits, it adds a zero digits FROM THE LEFT e.g. DDDDDDDDDDDDDDDDDDDDDDD becomes 0DDDDDDDDDDDDDDDDDDDDDDD).
    My question is: is all this behavior documented somewhere in JDBC specification and if not how other databases and drives behave on this matter. The code will be possibly used with other databases and I want to know if I can expect some definite behaviour or this is all implementation-specific? I found in JDBC specs that getString() can be used for BINARY data -- but not what it is supposed to return? Even Oracle JDBC documentation does not specify the behavior I discovered -- it just works like that but can I be sure it will be preserved in further versions? Should we raise an issue with Sun to clarify the JDBC specs?
    Any ideas/references? Please share your experience with different databases/drivers. Mine is Oracle 8.0.5.1.0, JDBC driver version is 9.0.1.0.0.
    Pavel

    You can download the JDBC docs from the sun site. I didn't find anything in it which documented the behavior you indicated.

  • ResultSet.getString(String) doesn't return the right text from database

    Hi everybody,
    I'm trying to read some text in Portuguese from a MS-Access database, but the special characters for Portuguese aren't correctly translated by ResultSet.getString(String).
    Here's my piece of code:
    private static void fetchEquipamentoEstabelecimento()
    try
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(
    " SELECT Eqp.NumSerie, Eqp.Estabelecimento, Estab.Nome, Estab.Cidade, Eqp.Data, Eqp.LPN " +
    " FROM Equipamento Eqp, Estabelecimento Estab " +
    " WHERE TabPreco = 23 " +
              " AND Eqp.Estabelecimento = Estab.Estabelecimento " +
    "ORDER BY NumSerie DESC");
    while(rs.next())
    String nome = rs.getString("Nome");
    System.out.println(rs.getLong("NumSerie")      + " " +
                             rs.getDate("Data")           + " " +
                             rs.getString("LPN")           + " " +
                             nome                              + " " +
                             rs.getString("Cidade"));
    stmt.close();
    catch(SQLException ex)
    printSQLException("fetchEquipamentoEstabelecimento()", ex);
    The output of this piece of code is 1 record joined from tables Equipamento and Estabelecimento:
    111222333 2001-12-15 JHK Pal<X>cio Cristal Guarda
    where the <X> is the greek letter beta. I was expecting a
    portuguese character which is an a with an accent: � (I hope the character was correctly displayed for you)
    I tried replacing
    String nome = rs.getString("Nome");
    with
    String nome = new String(rs.getString("Nome").getBytes(),codepage);
    with codepage="Cp860" (MS-DOS Portuguese)
    and codepage="Cp037" (USA, Canada (Bilingual, French), Netherlands, Portugal, Brazil, Australia)
    but other strange characters were displayed instead of the a with an accent.
    In the MS-Access table Estabelecimento, the column Nome has a Data Type of Text.
    I'm using:
    - JDK 1.2.2
    - MS Access 2000 (in Windows 2000)
    MS Access 97 (in Windows NT 4.0).
    Any help is deeply apreciated.

    Hi!
    When you establish connection to database, try explicitly give instructions about what encoding use your DB, e.g.:
    // connection properties
    Properties connInfo = new Properties();
    connInfo.put("user", username);
    connInfo.put("password", password);
    connInfo.put("charSet", "Cp1251"); // enter your codepage!!!
    // getconnection
    Connection db = DriverManager.getConnection(dataurl, connInfo);

  • Column exist but ResultSet.getString(String) return invalid column name

    With oracle 7 db the ResultSet.getString(String) works fine but after the upgrade to oracle 8 db it return invalid column name. ResultSet.getString(int) method works fine.
    Is this a bug in the driver?
    Thanks
    -Reda

    Yes I'm 100 % sure that the columns exist.
    -RedaWell then maybe it's a bug in the Oracle driver. Lord knows it wouldn't be the first time that's happened.

  • MsSQL 2000+Resultset.getString()

    Guys,
    I really need help for this issue. Here is the problem:
    - I am using Java 1.3.1/SE + EE
    - I have Ms SQL/2000
    This is the java code:
    Connection conn = null;
    String name;
    try
         conn = connectionPool.getConnection();
    Statement statement = conn.createStatement();
    ResultSet results = statement.executeQuery
    ("select * from USERAUTHENTICATION");
    while (results.next())
    name = results.getString("UserID");
    statement.close();
    finally
    if (conn != null)
    When java runs results.getString("UserID"), it gives this error:
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
    It is weird because this code works under Oracle database.
    I will appreciate any help.
    PS. I am not expert a Java programmer. So if you have an answer, please give a little bit detail.
    Thank you
    Murat

    Thanks for the answer. I am sure that the column name and my text are exactly the same. The column is VARCHAR.
    Let me give more info:
    - One thing I noticed is that Resultset.getDate() works properly.
    - Resultset.getString() does not work for none of varchar type in SQL.
    I make the connection that way:
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    } catch (Exception ignore) {}
    connectionPool = new MyConnectionPool(
    "jdbc:odbc:MYDATABASENAME", "sa", "");
    I am just wondering weather jdbc.odbc works properly or not.
    Thank you
    Murat

  • Problem with Sensitive ResultSet in SQL Server 2000

    Hi,
    I am trying to use SCROLL_SENSITIVE and CONCUR_UPDATABLE ResultSet accessing SQL Server 2000. I am using JDK 1.3 and supported JDBC driver. When I tried to insert a row, I got the following message:
    sp_cursor: The cursor identifier value provided (0) is not valid
    Is there any setting in SQL Server that I need to configure or do I miss something in my code?
    Thanks,
    Andi Setiyadi
    Here are my codes:
    cs = connection.prepareCall("{call sp_deptInfo (?,?,?)}", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    cs.setInt(1, 0);
    cs.setString(2, "");
    cs.setString(3, "name/orderbyid");
    rs = cs.executeQuery();
    rs.last();
    int rows = rs.getRow();
    rs.afterLast();
    rs.moveToInsertRow();
    rs.updateInt(1, rows + 1);
    rs.updateInt(2, Integer.parseInt(parentDept));
    rs.updateString(3, newDept);
    rs.updateInt(4, 1);
    rs.insertRow();

    I am getting the resultset by calling a stored procedure. I am not changing the stored procedure itself.Database drivers create 'connections' and 'statements' which match the SQL that you pass it. You are passing it a stored proc. The only information that it has is on a stored proc. It doesn't matter where the stored proc got its info from. The stored proc doesn't return tables and indexes into tables. It returns a result set (that is what your code suggests.) That is all the information that the driver has.
    Consider your stored proc might return this
    select * from mytable where ....
    But it could also do this
    select 'value1', 'value2', ... from dual
    On the java side it isn't not going to know which of the above that you did. Nor should it. And you can't update/insert into that second example.
    Or at least that is how I look at it.
    Your code looks like it is trying to 'update' the result set that a stored proc returned. And I simply don't see how that is possible. Or even why anyone would want to do it.

  • EjbFindAll method returns only primaryKeys.

    Hi All, Im having a problem when calling the findAll() method for my bean. It returns only the primary keys in a collection when it should be returning a collection of beans with full data. here is my EJB method for ejbFindAll() which returns just the primaryKeys which it should. Im wondering if my ejbLoad method might be f'd up?
       public Collection ejbFindAll() throws FinderException
             try
             Connection conn = qe.getConnection();
             PreparedStatement stmt = conn.prepareStatement("SELECT * FROM icountry");
             ResultSet rs = stmt.executeQuery();
             if (!rs.next())
                stmt.close();
                conn.close();
                throw new FinderException("Could not find any countries");
             Vector itemList = new Vector();
             itemList.addElement(rs.getString(1));
             while (rs.next())
                itemList.addElement(rs.getString(1));
             stmt.close();
             conn.close();
             return itemList;
          catch (SQLException e)
             throw new EJBException("Could not find any countries");
       }

    you are only supposed to return a collection of primary keys. in BMP EJB development, the ejbFindAll method will return the primary key collection to the container which will then lookup the beans using those keys.
    Fortuntely I figured out the problem. The ejbLoad function was not loading the other fields i needed. This solved the problem.

  • Data truncation when using resultset.getString() to a char type field

    In my table ,there is a char type field,such as a char(4) field, for multilanguage use,I put two "double-byte" character in it,
    when I using resultset.getString() to this char type field,I can't get the right result,one char was truncated, so I only get three char, for "double-byte" it 's error code
    this only happen on IBM JVM on AIX 5 , when I use oracle jdbc on windows hotspot vm , it works fine (we use the same oracle on AIX)
    is there any further setting for JDBC driver on AIX ? but it 's thin driver
    and the varchar type works fine at any paltform
    any help ?

    Hi jul!!!
    write like this:
    DATA : wa_flight_data TYPE bapisfldat,
    wa_add_info TYPE bapisfladd,
    wa_availability TYPE bapisflava,
    it_ret TYPE STANDARD TABLE OF bapiret2,
    wa_ret TYPE bapiret2.
    PARAMETERS : pa_carr TYPE sflight-carrid,
    pa_conn TYPE sflight-connid,
    pa_date TYPE sflight-fldate.
    CALL FUNCTION 'BAPI_FLIGHT_GETDETAIL'
    EXPORTING
    airlineid = pa_carr
    connectionid = pa_conn
    flightdate = pa_date
    IMPORTING
    flight_data = wa_flight_data
    additional_info = wa_add_info
    availibility = wa_availability
    TABLES
    *EXTENSION_IN =
    *EXTENSION_OUT =
    return = it_ret.
    write : / 'Flight Data: ',
    wa_flight_data-AIRLINEID,
    wa_flight_data-AIRLINE,
    wa_flight_data-CONNECTID,
    wa_flight_data-FLIGHTDATE,
    wa_flight_data-AIRPORTFR,
    wa_flight_data-CITYFROM,
    wa_flight_data-AIRPORTTO,
    wa_flight_data-CITYTO,
    wa_flight_data-DEPTIME,
    wa_flight_data-ARRTIME,
    wa_flight_data-ARRDATE,
    wa_flight_data-PRICE,
    wa_flight_data-CURR,
    wa_flight_data-CURR_ISO.
    similaryly for wa_add_info and wa_availability.
    becoz u r using work area directly in WRITE statement and
    wa_flight_data TYPE bapisfldat,
    wa_add_info TYPE bapisfladd,
    wa_availability TYPE bapisflava,
    contains both int and char data so u can print all of them together..They can be printed field by field.
    if any doubts..let me knw.
    hope it helps.
    kindly rewrd.

  • Re: ResultSet not returning same data

    Thanks to all who offered thoughts / advice on my post yesterday. For those interested here is what I found.
    The Problem -
    String data stored in MSSQL7 DB, transferred to MySQL4 DB, then pulled for an application did not match. Tests proved that the data IN the DB matched.
    What I found -
    Strings that were using unique chars such as French and German accent chars were NOT being returned correctly. It seems that when I call
    ResultSet.getString() using my SQL7 DB driver I would get a different result than when calling the same method in my MySQL4 Driver.
    To fix the problem I had to use
      String myString = new String(
                          ResultSet.getBytes()
                        );It seems that the DB driver was "assuming" what I wanted when using getString().
    Further tests proved that...
    MySQL DB Driver
    getString() == new String(getBytes()) true
    SQL7 Driver
    getString() == new String(getBytes()) false
    Just in case anyone was interested.
    Thanks for listening.
    ST

    In MySQL you can configure the charset used by the database. The default is "latin1", and if you have the correct data in your program, you can just use getString() and setString(). That setup handles strings with French and German accented characters, I know that because I have a program that does it.
    Perhaps your MS SQL configuration isn't working right? I don't have any experience on how to set that up.

  • A bug in the ResultSet.getString method?

    Hi,
    I am using a 8.1.6 database with UTF8 character set on a Win2000 machine. I've inserted some Hebrew characters into a table, and have been able to read them back properly using SQL+.
    However, when I try to retrieve these values from a simple Java program using the resultSet.getString method (via Oracle JDBC driver 8.1.6) I always get the '?' character for every Hebrew character (English characters work fine). However, if I call the 'getBytes' method of the result set, and create a new String instance from that data, it works fine - help needed!
    Thanks...
    null

    However, if I call the 'getBytes' method of the result set, and create a new String instance from that data, it works fine - help needed!Thanks...
    Please show me how to using 'getBytes' method of the result set and create a new string instance from THAT DATA, because this way doesn't work for me. I am converting ZHT16DBT to Unicode, and all I got is ?????.
    Please help me if you have any idea. THANKS
    null

  • Random NullPointerException on resultset.getstring

    I have been getting random NullPointerException ever since I have moved my code to a new dev server. I was using tomcat 3 and oracle 9i but moved to tomcat 6 and oracle10g express edition.
    The errors happen mostly when the server is under load.
    here is the code where is breaks
             while(rset.next()) {
                  signNum++;                                //LINE:2172
                  signed.set(rset.getString(1),"CHECKED");  //LINE:2173
                  mark.set(rset.getString(1));              //LINE:2174
              }and here is the stack trace:
    SEVERE: Servlet.service() for servlet MyServlet threw exception
    java.lang.NullPointerException
         at oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:397)
         at runner.MyServlet.getSignUp(MyServlet.java:2174)
    The exception does not happen everytime. It is also odd that the previous line was able to successfully call rset.getString but the very next line gets NullPointerException. Perhaps express edition is to blame?
    This is not the only code that gets exceptions. It happens all over seemingly random. It happens to resultset.getstring and resultset.getint.
    Frustrating

    You were right, it was a multithreading issue.
    Did a google search on "servlet multithreading" and got this article:
    http://www.javaworld.com/javaworld/jw-07-2004/jw-0712-threadsafe.html
    And I realized My servlet had a private variable that was being shared. Been a while since I have been using servlets. The funny thing is that this code ran for years w/o problem on jserv (the really old tomcat). They must not have implemented servlets with multithreading.
    Anyways, mega thanks.

  • Field with maximum length about 2000 characters?

    Dear all,
            is there any field which can have length upto 2000 characters,i have found only 255 as maximum.
    Plz help

    hello,
          for 2000 char you need to create data element on own.
    with regards,
    sumanth reddy
    Edited by: sumanth reddy on Feb 6, 2009 10:04 AM

Maybe you are looking for