Can't write to LONG datatype with OCCI.

I am trying to write data to a table with a long column as desc in one of the examples. (It is not acceptable to change LONG to CLOB.) For some reason I am getting a status of UPDATE_COUNT_AVAILABLE when I call executeUpdate when I should be getting NEEDS_STREAM_DATA. Because of that, getStream gets an INACTIVE stream which I can't use to write data. Can anybody tell me where am I going wrong with this? I have Oracle 9.2.0.4.0.
== BEGIN OUTPUT ==
Statement::RESULT_SET_AVAILABLE = 2
Statement::UPDATE_COUNT_AVAILABLE = 3
Statement::NEEDS_STREAM_DATA = 4
Statement::STREAM_DATA_AVAILABLE = 5
Statement::PREPARED = 1
Statement::UNPREPARED = 0
Status > 3
UpdateCount:1
Stream::READY_FOR_READ = 0
Stream::READY_FOR_WRITE = 1
Stream::INACTIVE = 2
Status > 2
Buffer:1111111111
== END OUTPUT ==
// BEGIN CODE
try
int len = 10;
conn = env->createConnection(username, password, url);
stmt = conn->createStatement("INSERT INTO TESTTAB(LONGCOL) VALUES (:1)");
stmt->setCharacterStreamMode(1, len);
stmt->executeUpdate();
printStatementStatus(); // I'm getting Status of 3 UPDATE_COUNT_AVAILABLE
cout << "UpdateCount:" << stmt->getUpdateCount() << endl;
istrm = stmt->getStream(1);
printStreamStatus();
char buffer[len];
memset (buffer, (char)49, len);
cout << "Buffer:" << buffer << endl;
istrm->writeBuffer(buffer, len);
char c = (char )"";
istrm->writeLastBuffer(c, 0);
stmt->closeStream(istrm);
env->terminateConnection(conn);
catch(SQLException ex)
cout << "Exception thrown." << endl;
cout << "Error number: " << ex.getErrorCode() << endl;
cout << ex.getMessage();
// END CODE

First off, don't use finalize(). It is never guaranteed to actually run.
Just add a cleanup() method to your Account class that flushes and closes the writer; and call it before you exit main().
Now, as for your Date problem
java.util.Date certainly does have a no-args constructor.
java.sql.Date does not.
Make sure you aren't getting a name collision. (Hint: If you're doing import java.foo.* Stop Doing That. just import the classes you need)

Similar Messages

  • Samba - Can't write to a share with "unix extensions = no" set in smb.

    Hello @all!
    Unfortunately, I have a problem, writing to a samba share which I'm unable to solve.
    My /etc/samba/smb.conf :
    [global]
    workgroup = w
    server string = server
    security = user
    load printers = no
    log file = /var/log/samba/%m.log
    max log size = 50
    dns proxy = no
    printing = bsd
    printcap name = /dev/null
    disable spoolss = yes
    unix extensions = no
    # if I comment above line, I can write to /home/shareuser/writable
    follow symlinks = yes
    wide links = yes
    [writable]
    comment = test
    writable = yes
    valid users = shareuser
    path=/home/shareuser/writable
    shareuser has valid passwd and smbpasswd (-a)
    I mount the share like this:
    mount -t cifs //server/writable mountpoint/ -o username=shareuser
    With
    unix extensions = yes
    , I can write to the share.
    With
    unix extensions = no
    , I can't write to the share.
    What I try to achieve in the end, is to have a writable password protected share, which forwards file permissions to clients and also allows them to access directories and files which are symlinked into the share directory (both from linux and windows clients if that's even possible).
    PS: I also posted this on stackexchange.com (http://unix.stackexchange.com/questions … n-smb-conf)
    PPS: Since I'm using systemd without syslog I had to create the /var/log/samba directory before smbd logged anything.
    Thank you in advance for any help
    Last edited by MCH (2012-09-23 20:59:41)

    First off, don't use finalize(). It is never guaranteed to actually run.
    Just add a cleanup() method to your Account class that flushes and closes the writer; and call it before you exit main().
    Now, as for your Date problem
    java.util.Date certainly does have a no-args constructor.
    java.sql.Date does not.
    Make sure you aren't getting a name collision. (Hint: If you're doing import java.foo.* Stop Doing That. just import the classes you need)

  • How can i write a XML file with oracle data ?

    How can i write a XML file using PL/SQL.
    Can i do as follows.
    1.Open a file using UTL_FILE.FOPEN(LC_DIR_LOC,'abc.xml','W')     ;
    2.write all the required tag and value using UTL.put_line
    that is enough. Is not, please guide me to write.
    gk

    Having Oracle 9i.
    One more doubt. In the speck, some constand values are there, When i write the same into file, How can i write ?.
    1. l_str := ' "E27" '
    or
    2. l_str := ' E27 '
    UTL_FILE.PUT_LINE(L_FILE_POI,l_str,TRUE);          
    1 case : in XML file : "E27"
    In 2 case : E27
    When we write a XML file through editors , we have to define the constant within quote . is it?      
    Which one can i use ? Or any other way is there ..
    Thanks and Regards
    gopi

  • I have a MacBook Air with Snow Leopard. I can read/write in both directions with 16 GB Fat32 drives but cannot with a 250GB NTFS drive.

    I have a MacBook Air. I also have a 250GB NTFS external drive which the Mac sees. i can copy and paste from the external drive to the Mac but not from the Mac to the external drive. However, I can go in both directions with a Fat32 16 GB flashdrive. Can anyone explain this to me?

    I've always recommented ext3 filesystem if you wanna use an external drive for both Windows and Mac OS as both can read and write to that filesystem.
    But obviously you'd have to format the drive (you can use Mac disk utility)

  • Can we write Exam 1z0-215 with out OPN ID

    Hi,
    Can any one tell me the procedure to register for exam 1z0-215 with out company OPN.
    I want to write this exam without having company partnership.
    Thanks,
    SG

    Sreenath,
    Exam 215 does not lead to a Certified Implementation Specialist certification. It leads to an Expert Certification - Oracle E-Business Suite R12 Financials Certified Expert Consultant, Payables. If you pass the 215 exam along with the 204 exam and complete the required training, you will be awarded the Certified Expert certification. You will not receive the Oracle PartnerNetwork Certified Specialist designation because that is awarded only to employees of partner organizations. However, the OPN Specialist designation is not a stand-alone certification. It is merely an indication that the candidate works for a partner company.
    However, if you wish to obtain an Oracle Certified Specailst certification in the aria of R12 financials, you can pursue:
    Oracle E-Business Suite 12 Financial Management Certified Implementation Specialist: Oracle General Ledger
    Oracle E-Business Suite 12 Financial Management Certified Implementation Specialist: Oracle Payables or
    Oracle E-Business Suite 12 Financial Management Certified Implementation Specialist: Oracle Receivables
    If you pursue one of those paths, your certification will be 'Certified Implementation Specialist' but you will still not receive the OPN Certified Specialist designation. As these certifications are geared toward partners who are implementing the product, my recommendation would be to go for the Expert certification. It will give you a broader foundation.
    Regards,
    Brandye Barrington
    Certification Forum Moderator

  • Can't write to strict typedef with Control Value:Set [Variant]

    Hey everyone,
    I inherited a project that uses stacked strict typedefs for the front panel, and I need to programmatically change one control, and it is within an event.  However, the control is a strict typedef in a strict typedef, and Control Valueet [Variant] has no effect on the specific control.  I have gotten the method to work in small test vi's without typedefs, so I'm pretty sure that is the problem.
    The only thing I can think of is that there is a unique way of referencing the control name through typedefs, and I don't know it.
    Any ideas?
    Thanks in advance,
    Jeff
    =============
    XP SP2, LV 8.2
    CLAD

    Lynn,
    Thanks for the reply.  It turns out that to programmatically Control Valueet [Variant] bundled controls, you can only pass in the top level bundle control name.  It took some tricky placement around my structures, but I eventually unbundled and bundled by name from the top level down to the bottom and back up to make it work.
    Thanks again
     - Jeff
    =============
    XP SP2, LV 8.2
    CLAD

  • Write Access to Oracle with ODBC?

    Hi,
    sorry this maybe a stupid question. Can i write data into Oracle with an ODBC driver?
    Thanks
    Marco

    Sure.
    Justin

  • Can I move ninety video files with their keyword tags from 'My Catalogue' into another catalogue?

    Can I move ninety video files with their keyword tags from 'My Catalogue' into a another catalogue?

    Nyinyikay a écrit:
    Can I move ninety video files with their keyword tags from 'My Catalogue' into a another catalogue?
    Two problems :
    1 - You can't merge catalogs in PSE
    2 - The usual workaround is to 'write metadata to files', export the files and 'get' them into the other catalog. But you can't write metadata to files with video files.
    The only thing you could do would be to duplicate the catalog and delete all pictures other than your ninety videos...

  • My first gen ipod mini does no longer sync with itunes 11.0. It says "cannot write or read". Ist this the end?

    My first gen ipod mini (that I use in my car) does no longer sync with itunes 11.0. It basically says "cannot write or read". Is this the "end of life" of that ipod?

    You mean you can't get to the Summary pane?
    If you  have iTunes 11 turn on the Sidebar. Go to iTunes>View and click on Show Sidebar. You can also do a Crtl+S to show the sidebar. The sidebar is where Devices appears. and Control+B to show the Menu bar

  • Exporting a table with Long datatype col. name

    Hello,
    I need help exporting a table, One of the column is long datatype.
    How can I do this without using Export Util?
    Is it possible.
    (If someone has a solution then PLEASE Email
    me)
    URGENT.
    Thanks.
    Pankaj Patel.

    Just wanted to find out, if you already solved this problem. I have a similar issue with long column. I am trying to sql dump a table with long column that will be imported into another database(probably using sql*load), but the spooled file puts the data from the long column in separate lines 80 char long and not on a single line. I have set the long to 64000 and linesize to 32000. Wrap is on too.
    null

  • Selecting From Column with Long Datatypes

    create table temp
    a long
    insert into temp values ('abc');
    commit;
    select * from temp
    where a = 'abc'
    I am getting the following error while am tring to select a = 'abc';
    ora-00997 : illegal use of LONG datatype
    How can i select values from a column with long datatypes

    insert into temp values ('abc');
    cannot (must not) work, when the column is type long (thats a numeric type!!)
    -> here you get an ora- 00911 errorcode
    that the select doesn't work then should be clear.
    mfg f.humer

  • How can I write new objects to the existing file with already written objec

    Hi,
    I've got a problem in my app.
    Namely, my app stores data as objects written to the files. Everything is OK, when I write some data (objects of a class defined by me) to the file (by using writeObject method from ObjectOutputStream) and then I'm reading it sequencially by the corresponding readObject method (from ObjectInputStream).
    Problems start when I add new objects to the already existing file (to the end of this file). Then, when I'm trying to read newly written data, I get an exception:
    java.io.StreamCorruptedException
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    Is there any method to avoid corrupting the stream? Maybe it is a silly problem, but I really can't cope with it! How can I write new objects to the existing file with already written objects?
    If anyone of you know something about this issue, please help!
    Jai

    Here is a piece of sample codes. You can save the bytes read from the object by invoking save(byte[] b), and load the last inserted object by invoking load.
    * Created on 2004-12-23
    package com.cpic.msgbus.monitor.util.cachequeue;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.RandomAccessFile;
    * @author elgs This is a very high performance implemention of Cache.
    public class StackCache implements Cache
        protected long             seed    = 0;
        protected RandomAccessFile raf;
        protected int              count;
        protected String           cacheDeviceName;
        protected Adapter          adapter;
        protected long             pointer = 0;
        protected File             f;
        public StackCache(String name) throws IOException
            cacheDeviceName = name;
            f = new File(Const.cacheHome + name);
            raf = new RandomAccessFile(f, "rw");
            if (raf.length() == 0)
                raf.writeLong(0L);
         * Whne the cache file is getting large in size and may there be fragments,
         * we should do a shrink.
        public synchronized void shrink() throws IOException
            int BUF = 8192;
            long pointer = getPointer();
            long size = pointer + 4;
            File temp = new File(Const.cacheHome + getCacheDeviceName() + ".shrink");
            FileInputStream in = new FileInputStream(f);
            FileOutputStream out = new FileOutputStream(temp);
            byte[] buf = new byte[BUF];
            long runs = size / BUF;
            int mode = (int) size % BUF;
            for (long l = 0; l < runs; ++l)
                in.read(buf);
                out.write(buf);
            in.read(buf, 0, mode);
            out.write(buf, 0, mode);
            out.flush();
            out.close();
            in.close();
            raf.close();
            f.delete();
            temp.renameTo(f);
            raf = new RandomAccessFile(f, "rw");
        private synchronized long getPointer() throws IOException
            long l = raf.getFilePointer();
            raf.seek(0);
            long pointer = raf.readLong();
            raf.seek(l);
            return pointer < 8 ? 4 : pointer;
         * (non-Javadoc)
         * @see com.cpic.msgbus.monitor.util.cachequeue.Cache#load()
        public synchronized byte[] load() throws IOException
            pointer = getPointer();
            if (pointer < 8)
                return null;
            raf.seek(pointer);
            int length = raf.readInt();
            pointer = pointer - length - 4;
            raf.seek(0);
            raf.writeLong(pointer);
            byte[] b = new byte[length];
            raf.seek(pointer + 4);
            raf.read(b);
            --count;
            return b;
         * (non-Javadoc)
         * @see com.cpic.msgbus.monitor.util.cachequeue.Cache#save(byte[])
        public synchronized void save(byte[] b) throws IOException
            pointer = getPointer();
            int length = b.length;
            pointer += 4;
            raf.seek(pointer);
            raf.write(b);
            raf.writeInt(length);
            pointer = raf.getFilePointer() - 4;
            raf.seek(0);
            raf.writeLong(pointer);
            ++count;
         * (non-Javadoc)
         * @see com.cpic.msgbus.monitor.util.cachequeue.Cache#getCachedObjectsCount()
        public synchronized int getCachedObjectsCount()
            return count;
         * (non-Javadoc)
         * @see com.cpic.msgbus.monitor.util.cachequeue.Cache#getCacheDeviceName()
        public String getCacheDeviceName()
            return cacheDeviceName;
    }

  • HT204416 My Safari is no longer working with many sites.  However Chrome and Firefox work fine.  I would like to re-install Safari in an effort to clear up the problem I can not resolve.

    My Safari is no longer working with many sites.  However Chrome and Firefox work fine.  I would like to re-install Safari in an effort to clear up the problem I can not resolve.

    1. From the Safari menu bar, select
              Safari ▹ Preferences... ▹ Extensions
    Turn all extensions OFF and test. If the problem is resolved, turn extensions back ON and then disable them one or a few at a time until you find the culprit.
    2. Select
              Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data...
    and confirm. Test.
    3. If the above steps don't resolve the problem, please describe it in more detail.

  • I used to have an application in my iPhone 4 and 4s that captures business card and creates its content to my contacts. Its no longer working with my i5. Can you recommend me a new apps for this same function

    I used to have an application in my iPhone 4 and 4s that captures business card and creates its content to my contacts. Its no longer working with my i5. Can you recommend me a new apps for this same function

    Try CardMunch it works well for me

  • After my ipad WIFI upgraded to 5.0.1, I can no longer sync with my PC?

    Recently, the new wireless upgrade worked wonderfully.  My ipad is correctly upgraded as of 11/13/11.  For the life of me, I can't figure out why my ipad will no longer sync with Itunes.  I realize that iCloud enables me to push various backups wirelessly, but I still want to sync with my iTunes in order to add playlists and content that will not reside on the cloud.
    When I say that it will no longer sync with itunes, I mean that I cannot get either an iPad or iPod Touch to show as being connected or synced with any number of apple USB cables conntected to my PC and iTunes.  Hard resets, computer reboots...since my upgrade, I can no longer connect these devices.  Can anyone tell me why I can't sync?
    Thank you in advance

    Minor update:  I have multiple PC's in my office.  This same iPad and other apple devices properly work and sync with their connection to this other computer.  Both computers are running the 64bit iTunes and both have Windows 7 64bit OS running on both machines.  I tried deactivating firewalls and even deleted the iTunes with a fresh installation with no avail.
    Something is keeping my Apple mobile devices (iPods, iPads) from being recognized within iTunes.  However, they all are properly recognized by my PC.

Maybe you are looking for