OCCI ResultSet- getString Linux problem

Hello,
On forum I found how the solve problem for OCCI programm witch using MSVC++. May be anybody known how to correct compile and linking OCCI demo on Linux? The demos crashed at ResultSet->getString().

It is my fault. I use Fedore Core 4 and gcc4.0. By default it linking with libstdc++.6.so, but when I linkint direct with libstdc++.5.so it OK.
Thank you for support!

Similar Messages

  • String allocation in ResultSet::getString() issue

    Hi all :)
    I have been learning the basics of OCCI and I am having a
    problem with Debug mode in MSVC. When I retrieve a string from
    ResultSet::getString, and the string goes out of scope, I get an
    assert about an invalid heap pointer.
    I think that somehow the ResultSet object is setting the pointer
    inside of the string object in a way which would circumvent the
    list of allocations on the debug heap. So that when the string
    destructor is called, it tries to free the internal pointer, and
    asserts.
    Everything works correctly in Release mode.
    Is there any suggested way of handling this? Or is there a debug
    version of the OCCI?
    Here is the simplistic offending code:
    while (rs->next())
    string username = rs->getString(1);
    string passwd = rs->getString(2);
    } <--- asserts here
    Any help would be great :)
    Thanks,
    Gerald Fishel

    OCCI has multiple copies of libraries that work with different compiler versions. Please make sure you are using the appropriate version of dll. You can search for this topic on OCCI forum.
    C++ Call Interface (OCCI)

  • Resultset.getString(). error

    I'm using Oracle 10g with jrockit 1.4.2_13.
    While looping through a cursor it blows up while executing resultset.getString().
    This code has been working for years and just blows up on a specific piece of data.
    The data it's trying to retrieve is .0548. Similar data is retrieved successfully.
    at oracle.sql.LnxLibThin.lnxnuc(LnxLibThin.java:6071)
    at oracle.sql.NUMBER.toText(NUMBER.java:2682)
    at oracle.jdbc.driver.NumberCommonAccessor.getString(NumberCommonAccessor.java:5303)
    at oracle.jdbc.driver.T4CNumberAccessor.getString(T4CNumberAccessor.java:83)
    at oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:355)
    I've tried to upgrade to the latest ojdbc14.jar driver with negative results.
    Here is the code snippet:
    for(int i=1;i<=size;i++){
    str_columnName = (String)ht_elementMappings.get((i)+"");
    sbf_rowData.append("\t\t<"+str_columnName+">");
    //Blows up on the 18th column during the getString
    str_columnValue = rs_object.getString(i);
    sbf_rowData.append( str_columnValue );
    sbf_rowData.append("</"+str_columnName+">");
    sbf_rowData.append("\n");
    sbf_rowData.append("\t</ROW>");
    sbf_rowData.append("\n");
    bufferedWriter.write(sbf_rowData.toString());
    Thanks in advance for any thoughts.

    (1) and (3) are related to gcc versions to use with OCCI. OCCI 10.1 and 10.2 support gcc 3.2.3 (and gcc 2.96). In addition, OCCI 10.2 supports gcc 3.4.3 (libraries are available on OTN).
    2) For retreiving the column names in a ResutSet, you need to use the ResultSet::getColumnListMetaData() interface. You can implement your own solution to call ResultSet::getXXX methods by column name e.g :-
    vector<MetaData> md = rs->getColumnListMetaData();
    map<string, int> columns;//column names to number mapping
    for (int i = 0; i < md.size(); i++) columns[md[i].getString(MetaData::ATTR_NAME)] = i;
    //now "use" column names!
    string ename = rs->getString(columns["ENAME"));
    -Shankar

  • 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.

  • 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

  • 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.

  • 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.

  • 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

  • ResultSet.getString() != toString()

    We have a method which retrieves values from a result
    set by simply doing resultSet.getString(index). This
    works fine in all cases and the result retrieved is
    as if the proper type is retrieved and a toString() is
    done on it, except for Timestamps. For Timestamps, we
    are getting a result in the format
    yyyy-M-d.h.mm. ss. fffffffff
    rather than the expected Timestamp.toString() format of
    yyyy-MM-dd hh:mm:ss.fffffffff
    When we later do Timestamp.valueOf(), it chokes because
    the format is incorrect. This is with WLS7SP2 and Oracle
    9.2. Has anyone else encountered this? Any patches to
    fix this available?
    : jay

    Jay Schmidgall wrote:
    We have a method which retrieves values from a result
    set by simply doing resultSet.getString(index). This
    works fine in all cases and the result retrieved is
    as if the proper type is retrieved and a toString() is
    done on it, except for Timestamps. For Timestamps, we
    are getting a result in the format
    yyyy-M-d.h.mm. ss. fffffffff
    rather than the expected Timestamp.toString() format of
    yyyy-MM-dd hh:mm:ss.fffffffff
    When we later do Timestamp.valueOf(), it chokes because
    the format is incorrect. This is with WLS7SP2 and Oracle
    9.2. Has anyone else encountered this? Any patches to
    fix this available?
    : jayI'll guess that you're using a type-2 driver, maybe ours. If I'm
    correct, our type-2 driver will rely on Oracle's OCI functions
    for most values of most data. if you call getString() we simply
    ask the OCI layer for the data as a string, and it does the formatting.
    The solution is to normalize to getTimestamp().
    Joe

  • ResultSet.getString(int) sometimes slow

    I'm working on an app that I'm attempting to optimize using JProfiler. In the course of inspecting how the time is being devided up, I noticed that there is one place in the code where ResultSet.getString(int) is taking much longer than it does in other areas. Usually, it averages anywhere from almost 0 ms to 0.01 ms per call. However, at one specific area, it's averaged anywhere from 7 to 45 ms per call. I can't find anything that sets it apart from any other calls to getResultSet() -- it happens to be averaged over several hundred rows, whereas the other, quicker calls are occurring when there's anywhere from 1 to tens of thousands of rows, so I can't see how the amount of data would have that affect. The result set is being pulled back along with several others from a single statement execution that has several queries, so they should all have the same fetch size. Does anyone have any ideas on what could cause a call to getString(int) at one specific place in the code to be 3-4 orders of magnitude slower than the others?
    Thanks for any help...

    I think you'd have to examine more of what is going on internally in the result set.
    As you mentioned fetch size could be something. It could be the particular type of column for which you are calling getString on.
    It could be a lot of things. There isn't really any answer for this other than to look at what your particular Result Set implementation is actually doing.

  • Everyones Oracle Linux Problem solved!!!

    Everyones Oracle Linux Problem solved!!!
    Here's something Linux people should relate to: Use what works!
    what works?
    NT works! NT works great with 8i AND OAS.
    No hassles at all!
    Up and running within one day!!!!
    Guaranteed!
    U don't see a NT forum here with people having ridiculous install problems like Linux people?
    Perhaps Oracle should moderate this newsgroup and even give an authorative answer or two?
    null

    I have switched our development and soon production databases to Linux because it runs like a charm. Fast and efficient, no problems. The installer has been a problem no doubt because Oracle put less of an emphasis on debugging their Linux installer than their idiot-proof NT installer.
    By the way, I was able to circumvent installer problems by just linking svrmgrl to svrmgrlO; this avoided the dreaded segmentation fault and kicked everything open just fine.
    BTW, about NT; what makes an OS is not how well everything works when everything is going well, but how bad it gets when something goes bad. For instance, the segmentation faults on Linux weren't a problem because I just picked up and continued; on NT you'd have to restart the whole system...not a pleasant feature.
    null

  • 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);

  • 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.

  • OCCI ResultSet problems

    Hi!
    My problem is the same as this thread.
    OCCI programming
    I call the method getColumnListMetaData and the method returns a STL vector with
    Metadata objects and it works fine. My problem is when the vector should be deallocated.
    When I run the testprogram a get this error message:
    *** glibc detected *** double free or corruption (!prev): 0x08121568 ***
    The sample code....
    vector<MetaData> md = rs->getColumnListMetaData();
    //column names to number mapping
    map<string, int> columns;
    for (int i = 0; i < md.size(); i++)
         columns[md[ i ].getString(MetaData::ATTR_NAME)] = i;
    My versions:
    CentOS release 4.2 (Final)
    Kernel 2.6.9-34.EL
    gcc version 3.4.4
    OCCI 10g Release 2 (10.2)

    Code:
    int test(int argc, char **argv)
         const string userName = ".........";
         const string password = "....";
         const string connectString = "..";
         Environment *env = Environment::createEnvironment();
              Connection *conn = env->createConnection(
                   userName, password, connectString);
              Statement *stmt = conn->createStatement(
                   "SELECT * FROM TEST_TABLE");
              ResultSet *rs = stmt->executeQuery();
              vector<MetaData> md = rs->getColumnListMetaData();
              //column names to number mapping
              map<string, int> columns;
              for (int i = 0; i < md.size(); i++)
                   columns[md[ i ].getString(MetaData::ATTR_NAME)] = i;
    cout << "Column name: " << md[0].getString(MetaData::ATTR_NAME) << endl;
              stmt->closeResultSet(rs);
              conn->terminateStatement(stmt);
              env->terminateConnection(conn);
    Environment::terminateEnvironment(env);
    return 0;
    Output:
    Column name: ID
    *** glibc detected *** double free or corruption (!prev): 0x08c52568 ***
    Aborted

  • Compiling occi with Mingwstudio on Linux - Problem

    Hello,
    I downloaded the oracle-instantclient-devel-10.2.0.1-1.i386.rpm and the oracle-instantclient-basic-10.2.0.1-1.i386.rpm, converted everything with alien to *.deb-Files and installed it on my debian-machine. Now I hoped to get a test programm compiled - but I don't have success. Code goes like that:
    #include "oracle/occi.h"
    using namespace oracle::occi;
    Environment *env;
    Connection *conn;
    Statement *stmt;
    void Mainform::OnButton1 (wxCommandEvent& event)
         env = Environment::createEnvironment (Environment::DEFAULT);
    Environment::terminateEnvironment (env);
    Everything will compile, when I put the /usr/include/oracle/10.2.0.1/client-Path as an additional include directory under Project Settings. But the linker hangs - it hangs because I have got no idea, what the settings are for the Linker libraries and the additional library path. Error message is llike this:
    Linking...
    /dateien/projects/oracletest/Release/mainform.o(.text+0x6ee): In function `Mainform::OnButton1(wxCommandEvent&)':
    : undefined reference to `oracle::occi::Environment::createEnvironment(oracle::occi::Environment::Mode, void*, void* (*)(void*, unsigned), void* (*)(void*, void*, unsigned), void (*)(void*, void*))'
    /dateien/projects/oracletest/Release/mainform.o(.text+0x7a7): In function `Mainform::OnButton1(wxCommandEvent&)':
    : undefined reference to `oracle::occi::Environment::terminateEnvironment(oracle::occi::Environment*)'
    collect2: ld returned 1 exit status
    oracletest - 2 error(s), 0 warning(s)
    Can anyone help me?

    How does it stop? Do you get a NoClassDefFoundError? If that's so, then probably com.apache.crimson.parser.XMLReaderImpl is not on your classpath. Do you have the correct version of Crimson on your classpath?
    By the way, do you really want to explicitly have your program use Crimson? The XML API was set up in such a way that it is possible to plug in different XML parsers, but using your code you bind your program to one specific parser. Try:
    XMLReader xr = XMLReaderFactory.createXMLReader();
    and set the system property "org.xml.sax.driver" to "org.apache.crimson.parser.XMLReaderImpl":
    java -Dorg.xml.sax.driver=org.apache.crimson.parser.XMLReaderImpl myclass
    Jesper

Maybe you are looking for

  • How can we get Dynamic columns and data with RTF Templates in BI Publisher

    How can we get Dynamic columns and data with RTf Templates. My requirement is : create table xxinv_item_pei_taginfo(item_id number, Organization_id number, item varchar2(4000), record_type varchar2(4000), record_value CLOB, State varchar2(4000)); ins

  • How to go on production system for webcenter sites

    Hi, I have installed the webcenter sites and deployed them on weblogic. AVISports and FirstSiteII sample sites also been configured, now how can I go on delivery/production url? IF we need to install gadgets on top of it then how can we proceed? Than

  • CS3 Programs hang and never launch on Vista and Win7

    This is kind of a repeat from my previous post... but I installed on Win7 and tried to launch the CS3 Production premium programs and nothing happens... So then I uninstalled and installed on my Vista 64 bit machine.... Same exact problem. http://for

  • Help with updating model and serial on thinkpad tablet 2

    Hi was after the procedure for changing / updating the MTM and serial number on a thinkpad tablet 2 that has just had a new mainboard installed. We are a authorised warranty center in AUS yur help would be appreciated

  • How To: Find and replace multiple words in one Click ?

    I have an file with about 150 Pages where I want to replace a word about 500 time by one click. Find and Replace works but only with one word. How can I do it by one click ?