Unicode in OCI

I know how to retrieve column text values in UCS2 charset, and i need to retrieve error text in this charset also. Somebody know, how to do this ? (This is actually in multi-tier applications. When clients uses different languages and codepages, it is good idea to use unicode in middle-tier)

In 9i you can retrieve the error message in
Unicode, earlier releases do not support
it.

Similar Messages

  • OBIEE  not working-plz help me

    Hi My name is Priya
    I installed OBIEE 10.1.3.4.2 sucessfully on windows 7 ultimate OS and database Oracle 11g R2 11.2.0.1.0
    but when I tried to Import SH schema from OBIEE Admin Tool the SH schema is not appearing in the select data source under connection type ODBC 3.5.
    I can see only DSN:Analyticsweb and Driver:Oracle BI server in select datasource under ODBC 3.5.
    and even I cannot see the SH schema under any connection types(ODBC 2.0,DB2 CLI(unicode),XML,OCI 10g/11g.
    but when I checked System DSN in ODBC Data Source Administrator even the SH schema was added as (Name:SH Driver:Oracle in OraDb11g_home1).
    everything looks ok,but still I dont understand why SH schema is not appearing when am trying to Import it from Database in Oracle BI Administration.
    Please help me I tried everywhere but no one is able to resolve my issue.
    even you can email your responses at [email protected]
    waiting for your replies with eager

    Hi,
    Thanks for your reply I really appreciate it.
    I checked in SQL with the query select table_name from all_tables where owner='SH';
    but it came with has no rows selected message
    and also I tried to download the schema from the link which you have sent(http://gerardnico.com/wiki/database/oracle/sample_schemas)
    but when I clicked the link it took me to Oracle Database - Sample Schemas and there under SH I clicked on ■Installation of the Oracle® Database Sample Schemas
    but when I clicked on that the page says Http 400 bad request and the webpage cannot be found.
    and also I clicked ■Oracle® Database Sample Schemas under reference,here also the page says samething.
    and also I downloaded SH.zip under OBIEE,but here once I open the SH folder and opened sh in this folder 'SH' directly Oracle BI Administration tool is opening.
    In this tool I can see the SH schema under presentation,Buisness model & mapping,Physical layers,but again when I start the OBIEE Administration tool under Oracle Business Intelligence from All programs and trying to import from database the SH is not appearing under ODBC 3.5 in select datasource.
    I dont understand where Iam going wrong,please help me.

  • New free/open-source tool to encapsulate the OCI interface

    Hello,
    Here is a short presentation and a link to a new free tool available on soureceforge.net.
    This tool is a powerful "wrapper" to encapsulate the OCI interface:
    Introduction
    OCILIB is a free, open source and platform independant library, written in C, that access Oracle Databases.
    The OCILIB library :
    * Encapsulates OCI (Oracle Call Interface which is powerful but complex)
    * Hides OCI complexity
    * Proposes instead a simple, readable and reusable API
    * Offers up to 310 simple and straightforward APIs.
    Introduction
    Current version : 2.3.0 (2008-03-30)
    Main features
    * Data binding
    * Integrated smart define and fetch mecanisms
    * Full Unicode support on all platorms
    * Multi row fetching
    * Binding array Interface for fast and massive bulk operations
    * Reusable Statements
    * Connection Pooling
    * Global Transactions
    * Returning DML feature support
    * ROWIDs support
    * Named Types (Object types) support (User or Builtin)
    * Cursors
    * PL/SQL blocks
    * PL/SQL Ref cursors and Nested tables
    * LOB (BLOBs/ FILEs)
    * Supports lobs > 4Go
    * Long datatype (piecewise operations)
    * Provides "All in one" Formatted functions (printf's like)
    * Smallest possible memory usage
    * Date/time management
    * Timestamps and Intervals support
    * Error handling
    * Describe database schema objects
    * Access columns by index or name
    * Hash tables API
    * Portable Threads and mutexes API
    * Supports static / shared oracle linkage
    * Support runtime loading (no OCI libs required at compile / time)
    * Great performances (straight OCI encapsulation)
    Download
    Get OCILIB from OCILIB Project page at Sourceforge Website:
    http://orclib.sourceforge.net/
    Hope this would help some of you ;D
    Francois

    Don't give up just because there are other options out there.
    Adobe is only giving up the free tool for education purposes, or unemployed developer.  You didn't say if you were one of those.
    I believe over time there will be plenty of room for alternate IDE approaches that support the Flex Framework; and in fact there are quite a few options already out there.

  • How to send Unicode to Oracle

    Hello,
    We have an intranet application that is live for sometime now. Our new requirement is to be able to store and view Japanese characters in some of the fields.
    We have Oracle 9.2.0.5 with NLS_CHARSET as UTF8. Our application server is WebLogic6.1sp6 on Solaris v5.8 64 bit.
    We use both thin driver (classes12.jar) and WebLogic 6.1 provided OCI thin driver, on different places of our application. The database column intended to store Japanese characters is just a VARCHAR and not NCHAR.
    I'm copying some Japanese characters from various websites and trying to input them in my application through browser. We are able to store Japanese characters, but they are occupying upto 8 bytes per character. Actually Unicode databases only should take upto 3 bytes per character. My requirement is to be able to store upto 1300 Japanese characters in a VARCHAR2(4000) field. Currently, it is only storing about 500 Japanese characters. When trying to store more than this, it is throwing a "java.sql.SQLException: Inserted value too large for column".
    I have already consulted Oracle and the reply I got is that it is not Oracle problem as the application needs to be changed so that it feeds physical UTF8 codepoints to Oracle. On their suggestion, I used iSQLPlus interface and was able to store 1300 Japanese characters in the database, by issuing an update statement. But the same data when seen from iSQLPlus is showing characters as follows: "& # 31258 ; & # 21481 ; & # 27470 ; & # 34507 ;" (I have added blanks so that your browser does not render it in Japanese). Hence they concluded that our application is NOT using UTF8 codpoints but a HTML based representation system using the ""& #" and then the unicode identifier for that character. For Oracle this is NOT a character, It's a string of 8 characters and hence it occupies 8 bytes. Please help me on how to feed UTF8 codepoints to Oracle?
    I have already tried putting NLS_LANG=AMERICAN_AMERICA.UTF8 in my WebLogic startup script. I also tried putting
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> in my JSP's. (This actually makes the problem even worse that it displays junk instead of Japanese while retrieving).
    Are there any other special settings that I need to be able to store Unicode characters? Please help.
    Thanks
    Varma
    [email protected]

    thanks the following steps did the trick
    1. I put the following info in weblogic.xml
    <charset-params>
    <input-charset>
    <resource-path>/*</resource-path>
    <java-charset-name>UTF8</java-charset-name>
    </input-charset>
    </charset-params>
    2. I added the weblogic.codeset=UTF8 for the WebLogic Oracle OCI connection pool
    3. I added the nls_charset12.zip in the CLASSPATH for the Oracle thin driver that I'm using.
    4. Added the <%@ page contentType="text/html; charset=utf-8"%> (Somehow the <jsp-param><encoding> tag does not work in weblogic.xml)

  • Error during Unicode Conversion - Import

    Hi,
    I am doing a Unicode conversion, done with the system export, while doing the
    import during the Import ABAP phase system is throwing the error with R3load.
    R3load -testconnect fails with following error.
    emalonsbx002:wuuadm 18% R3load -testconnect
    sapparam: sapargv( argc, argv) has not been called.
    sapparam(1c): No Profile used.
    sapparam: SAPSYSTEMNAME neither in Profile nor in Commandline
    R3load: START OF LOG: 20071113095228
    R3load: sccsid @(#) $Id: //bas/700_REL/src/R3ld/R3load/R3ldmain.c#14 $ SAP
    R3load: version R7.00/V1.4 [UNICODE]
    Compiled Oct 20 2007 06:20:06
    R3load -testconnect
    DbSl Trace: OCI-call 'OCISessionBegin' failed with rc=1033
    DbSl Trace: CONNECT failed with sql error '1033'
    DbSl Trace: OCI-call 'OCISessionBegin' failed with rc=1033
    DbSl Trace: CONNECT failed with sql error '1033'
    (DB) ERROR: db_connect rc = 256
    DbSl Trace: OCI-call 'OCISessionBegin' failed with rc=1033
    DbSl Trace: CONNECT failed with sql error '1033'
    DbSl Trace: OCI-call 'OCISessionBegin' failed with rc=1033
    DbSl Trace: CONNECT failed with sql error '1033'
    (DB) ERROR: DbSlErrorMsg rc = 99
    R3load: job finished with 1 error(s)
    R3load: END OF LOG: 20071113095230
    Please let me know if anybody have any idea on this.
    Thanks in advance.

    Your database isn´t fully started yet (in shutdown or startup) - check your alert.log
    Also see
    Note 655240 - Composite SAP note: ORA-01033
    Markus

  • BUG: retrieving NCHAR value using ViewObject returns "???" with OCI driver

    Hi,
    after upgrading JDeveloper to 10.1.3.1 we cannot use OCI JDBC drivers, because they don't work correctly - characters, that do not exist in database character set (EE8ISO8859P2 in our case) are converted to "?". Thin driver works well. We need to use OCI, because we had some issues with RAC with thin driver.
    Test case is easy: create table with NCHAR column, populate with unicode data, create ViewObject to select from this table and it will work only with THIN and not with OCI driver. This worked well with 10.1.3.0. When I tried to directly connect to DB and select that table using java.sql.Statement, it worked with both drivers, that's why I suspect the mechanics inside ADF BC.
    I logged a SR for this in Metalink, but try this way as well, for someone else could hit the same problem.
    Thanks for any help,
    Viliam

    Hi,
    after upgrading JDeveloper to 10.1.3.1 we cannot use OCI JDBC drivers, because they don't work correctly - characters, that do not exist in database character set (EE8ISO8859P2 in our case) are converted to "?". Thin driver works well. We need to use OCI, because we had some issues with RAC with thin driver.
    Test case is easy: create table with NCHAR column, populate with unicode data, create ViewObject to select from this table and it will work only with THIN and not with OCI driver. This worked well with 10.1.3.0. When I tried to directly connect to DB and select that table using java.sql.Statement, it worked with both drivers, that's why I suspect the mechanics inside ADF BC.
    I logged a SR for this in Metalink, but try this way as well, for someone else could hit the same problem.
    Thanks for any help,
    Viliam

  • Unicode in php oracle

    While using multilanguage in php/oracle iam facing some issues
    i gave input as : Portuguese: O próximo vôo à
    and got output as : Portuguese: O pr?ximo v?o ?
    for some special characters it is replaced by '?' mark.
    iam using php5 and orcle 9 and OCI for connecting.
    i gave NLS_CHARACTERSET as UTF8
    and the unicode datatype as NVARCHAR2(100)
    Plz some one help me out in solving it

    hi..
    using alter session in php i changed my nsl_lang to PORTUGUESE
    but still the data is stored in ? for some special characers
    Array
    [PARAMETER] => Array
    [0] => NLS_LANGUAGE
    [1] => NLS_TERRITORY
    [2] => NLS_CURRENCY
    [3] => NLS_ISO_CURRENCY
    [4] => NLS_NUMERIC_CHARACTERS
    [5] => NLS_CALENDAR
    [6] => NLS_DATE_FORMAT
    [7] => NLS_DATE_LANGUAGE
    [8] => NLS_CHARACTERSET
    [9] => NLS_SORT
    [10] => NLS_TIME_FORMAT
    [11] => NLS_TIMESTAMP_FORMAT
    [12] => NLS_TIME_TZ_FORMAT
    [13] => NLS_TIMESTAMP_TZ_FORMAT
    [14] => NLS_DUAL_CURRENCY
    [15] => NLS_NCHAR_CHARACTERSET
    [16] => NLS_COMP
    [17] => NLS_LENGTH_SEMANTICS
    [18] => NLS_NCHAR_CONV_EXCP
    [VALUE] => Array
    [0] => PORTUGUESE
    [1] => AMERICA
    [2] => $
    [3] => AMERICA
    [4] => .,
    [5] => GREGORIAN
    [6] => DD-MON-RR
    [7] => PORTUGUESE
    [8] => UTF8
    [9] => WEST_EUROPEAN
    [10] => HH.MI.SSXFF AM
    [11] => DD-MON-RR HH.MI.SSXFF AM
    [12] => HH.MI.SSXFF AM TZR
    [13] => DD-MON-RR HH.MI.SSXFF AM TZR
    [14] => $
    [15] => AL16UTF16
    [16] => BINARY
    [17] => BYTE
    [18] => FALSE
    Input i gave : próximo vôo à
    out put : pr??ximo v??o ??

  • To Determine Unicode Datatype encoding

    Hi,
    Going through the Oracle documentation found that Oracle Unicode datatype (NCHAR or NVARCHAR2) supports AL16UTF16 and UTF8 Unicode encodings.
    Is there a way to determine which encoding is being used by Oracle Unicode datatypes thorugh OCI interface?
    Thanks,
    Sachin

    That's a rather hard problem. You would, realistically, either have to make a bunch of simplifying assumptions based on the data or you would want to buy a commercial tool that does character set detection.
    There are a number of different ways to encode Unicode (UTF-8, UTF-16, UTF-32, USC-2, etc.) and a number of different versions of the Unicode standard. UTF-8 is one of the more common ways to encode Unicode. But it is popular precisely because the first 127 characters (which is the majority of what you'd find in English text) are encoded identically to 7-bit ASCII. Depending on the size and contents of the document, it may not be possible to determine whether the data is encoded in 7-bit ASCII, UTF-8, or one of the various single-byte character sets that are built off of 7-bit ASCII (ISO 8859-15, Windows-1252, ISO 8859-1, etc).
    Depending on how many different character sets you are trying to distinguish between, you'd have to look for binary values that are valid in one character set and not in another.
    Justin

  • UNICODE text

    Hi,
    Could anyone tell me how to bind UNICODE text and ANSI to SQL statement as parameters or result columns in Windows environment ? I mean to bind in the same statement one parameter as an UNICODE text and second one as an ANSI (multibyte) text.
    Thx

    Use the following code UTF and NLS
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <oci.h>
    static text username = (text ) "SCOTT";
    static text password = (text ) "TIGER";
    /* Define SQL statements to be used in program. */
    static text insert = (text ) "INSERT INTO nls_demo(myno, myname, mydesc)\
    VALUES (:myno, :myname, :mydesc)";
    static text maxemp = (text ) "SELECT NVL(MAX(myno), 0) FROM nls_demo";
    static text selemp = (text ) "SELECT myno, myname, mydesc FROM nls_demo";
    static OCIEnv *envhp;
    static OCIServer *srvhp;
    static OCIError *errhp;
    static OCISvcCtx *svchp;
    static OCIStmt stmthp0, stmthp1, stmthp2, stmthp3;
    static OCIDefine defnp0 = (OCIDefine ) 0;
    static OCIDefine defnp1 = (OCIDefine ) 0;
    static OCIDefine defnp2 = (OCIDefine ) 0;
    static OCIDefine defnp3 = (OCIDefine ) 0;
    static OCIDefine defnp4 = (OCIDefine ) 0;
    static OCIBind bnd1p = (OCIBind ) 0; /* the first bind handle */
    static OCIBind bnd2p = (OCIBind ) 0; /* the second bind handle */
    static OCIBind bnd3p = (OCIBind ) 0; /* the third bind handle */
    static sword status;
    #define MYBUFSIZE 4000
    #define MYLONGSIZE 4000
    static utext ubuf[MYBUFSIZE]; /* a buffer for unicode conversion */
    static char tbuf[MYBUFSIZE]; /* a buffer for text conversion */
    static void checkerr(OCIError *errhp, sword status);
    static void cleanup(void);
    /* Converting buffers from and to unicode */
    static size_t mytxt2uni();
    static size_t myuni2txt();
    /* ------- MAIN program ------- */
    int main(argc, argv)
    int argc;
    char *argv[];
    sword empno;
    text ename[40];
    sb4 enamelen = 40;
    utext mydesc[MYLONGSIZE];
    sb4 mydesclen = MYLONGSIZE;          
    sb2 ename_ind, mydesc_ind, empno_ind, ename_rlen, mydesc_rlen;
    utext *ename_u;
    size_t blen=0;
    int i;
    ub2 myucs2id = OCI_UCS2ID; /* Unicode character set ID */
    OCISession authp = (OCISession ) 0;
    /* Allocate space for the Unicode buffer */
    ename_u = (utext *) malloc((size_t) ((enamelen + 1) * sizeof(utext)));
    if (!ename_u)
    fprintf(stderr, "Cannot allocate memory\n");
    return 1;
    /* Set up the OCI environment */
    (void) OCIInitialize((ub4) OCI_DEFAULT, (dvoid *)0,
    (dvoid * (*)(dvoid *, size_t)) 0,
    (dvoid * (*)(dvoid *, dvoid *, size_t))0,
    (void (*)(dvoid *, dvoid *)) 0 );
    (void) OCIEnvInit( (OCIEnv **) &envhp, OCI_DEFAULT, (size_t) 0, (dvoid **) 0 );
    (void) OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &errhp, OCI_HTYPE_ERROR,
    (size_t) 0, (dvoid **) 0);
    /* server contexts */
    (void) OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &srvhp, OCI_HTYPE_SERVER,
    (size_t) 0, (dvoid **) 0);
    (void) OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &svchp, OCI_HTYPE_SVCCTX,
    (size_t) 0, (dvoid **) 0);
    (void) OCIServerAttach( srvhp, errhp, (text *)"", strlen(""), 0);
    /* set attribute server context in the service context */
    (void) OCIAttrSet( (dvoid *) svchp, OCI_HTYPE_SVCCTX, (dvoid *)srvhp, (ub4) 0,
    OCI_ATTR_SERVER, (OCIError *) errhp);
    (void) OCIHandleAlloc((dvoid *) envhp, (dvoid **)&authp, (ub4) OCI_HTYPE_SESSION,
              (size_t) 0, (dvoid **) 0);
    (void) OCIAttrSet((dvoid *) authp, (ub4) OCI_HTYPE_SESSION,
    (dvoid *) username, (ub4) strlen((char *)username),
    (ub4) OCI_ATTR_USERNAME, errhp);
    (void) OCIAttrSet((dvoid *) authp, (ub4) OCI_HTYPE_SESSION,
    (dvoid *) password, (ub4) strlen((char *)password),
    (ub4) OCI_ATTR_PASSWORD, errhp);
    checkerr(errhp, OCISessionBegin ( svchp, errhp, authp, OCI_CRED_RDBMS,
                   (ub4) OCI_DEFAULT));
    (void) OCIAttrSet((dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX,
    (dvoid *) authp, (ub4) 0,
    (ub4) OCI_ATTR_SESSION, errhp);
    checkerr(errhp, OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &stmthp0,
    OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0));
    checkerr(errhp, OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &stmthp1,
    OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0));
    checkerr(errhp, OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &stmthp2,
    OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0));
    checkerr(errhp, OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &stmthp3,
    OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0));
    /* Retrieve the current maximum employee number */
    /* Prepare the statement */
    checkerr(errhp, OCIStmtPrepare(stmthp0, errhp, maxemp,
    strlen((const char *)maxemp),
    (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT));
    /* bind the input variable */
    checkerr(errhp, OCIDefineByPos(stmthp0, &defnp0, errhp, 1, (dvoid *) &empno,
    (sword) sizeof(sword), SQLT_INT, (dvoid *) 0, (ub2 *)0,
    (ub2 *)0, OCI_DEFAULT));
    /* execute and fetch */
    if (status = OCIStmtExecute(svchp, stmthp0, errhp, (ub4) 1, (ub4) 0,
    (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT))
    if (status == OCI_NO_DATA)
    empno = 10;
    else
    checkerr(errhp, status);
    cleanup();
    return OCI_ERROR;
    empno+=10;
    /* Insert new data */
    checkerr(errhp, OCIStmtPrepare(stmthp2, errhp, insert,
    strlen((const char*)insert),
    (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT));
    /* Bind the placeholders in the INSERT statement. */
    checkerr(errhp, OCIBindByName(stmthp2, &bnd1p, errhp,(text*)":MYNO", strlen(":MYNO"),
    (dvoid *) &empno,
    (sword) sizeof(empno), SQLT_INT, (dvoid *) &empno_ind,
    (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0,
    OCI_DEFAULT));
    strcpy((char*)ename, "Scott Tiger"); /* just a fixed name for the demo */
    /* Convert buffer to Unicode */
    mytxt2uni(envhp, ename_u, enamelen+1, ename, enamelen+1);
    /* --- Bind the input Unicode buffer for the NAME column --- */
    checkerr(errhp, OCIBindByName(stmthp2, &bnd2p, errhp,
    (text*)":MYNAME", strlen(":MYNAME"),
    (dvoid *) ename_u,
    (enamelen+1) * sizeof (utext), SQLT_STR, (dvoid *) 0,
    (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0,
    OCI_DEFAULT));
    /* Set the attribute for the buffer to be Unicode encoded */
    checkerr(errhp,
    OCIAttrSet(bnd2p, OCI_HTYPE_BIND, &myucs2id, 0, OCI_ATTR_CHARSET_ID, errhp));
    /* Set the culomn width on the server */
    checkerr(errhp,
    OCIAttrSet(bnd2p, OCI_HTYPE_BIND, &enamelen, 0, OCI_ATTR_MAXDATA_SIZE, errhp));
    /*--- Bind the long DESC column using Unicode buffer ---- */
    checkerr(errhp, OCIBindByName(stmthp2, &bnd3p, errhp,
    (text*)":MYDESC", strlen(":MYDESC"),
    (dvoid *) mydesc,
    MYLONGSIZE * sizeof(utext), SQLT_LNG, (dvoid *) 0,
    (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0,
    OCI_DEFAULT));
    checkerr(errhp,
    OCIAttrSet(bnd3p, OCI_HTYPE_BIND, &myucs2id, 0, OCI_ATTR_CHARSET_ID, errhp));
    checkerr(errhp,
    OCIAttrSet(bnd3p, OCI_HTYPE_BIND, &mydesclen, 0, OCI_ATTR_MAXDATA_SIZE, errhp));
    /* fill data into long column - for demo purpose some numbers */
    for (i=0; i < MYBUFSIZE-1; i++)
    tbuf[i] = (text)(i % 10 + (text)'0');
    tbuf[i] = (text)0;
    empno_ind = 0; /* Reset indicator */
    /* Convert long buffer to Unicode */
    blen = mytxt2uni(envhp, mydesc, MYLONGSIZE, tbuf, MYBUFSIZE);
    /* --- Finally execute and commit the statement ---- */
    checkerr(errhp, OCIStmtExecute(svchp, stmthp2, errhp, (ub4) 1, (ub4) 0,
    (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT));
    checkerr(errhp, OCITransCommit(svchp, errhp, 0));
    /* Selecting the data again */
    /* --- Prepare the select statement ------ */
    checkerr(errhp, OCIStmtPrepare(stmthp3, errhp,
    selemp, strlen((char *)selemp),
    (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT ));
    /* Define the output variable for the select-list. */
    checkerr(errhp, OCIDefineByPos(stmthp3, &defnp2, errhp, 1,
    (dvoid *) &empno, sizeof(empno), SQLT_INT,
         (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT));
    checkerr(errhp, OCIDefineByPos(stmthp3, &defnp3, errhp, 2,
    (dvoid *) ename_u, (enamelen+1) * sizeof(utext), SQLT_STR,
         (dvoid *) &ename_ind, (ub2 *) &ename_rlen,
    (ub2 *) 0, OCI_DEFAULT));
    /* Set the output name buffer to be Unicode encoded */
    checkerr(errhp,
    OCIAttrSet(defnp3, OCI_HTYPE_DEFINE, &myucs2id, 0, OCI_ATTR_CHARSET_ID, errhp));
    checkerr(errhp, OCIDefineByPos(stmthp3, &defnp4, errhp, 3,
    (dvoid *) mydesc, MYLONGSIZE * sizeof(utext), SQLT_LNG,
         (dvoid *) &mydesc_ind, (ub2 *) &mydesc_rlen,
    (ub2 *) 0, OCI_DEFAULT));
    /* Set the output desc buffer to be Unicode encoded */
    checkerr(errhp,
    OCIAttrSet(defnp4, OCI_HTYPE_DEFINE, &myucs2id, 0, OCI_ATTR_CHARSET_ID, errhp));
    /* Execute the select command */
    checkerr(errhp, OCIStmtExecute(svchp, stmthp3, errhp, (ub4) 0, (ub4) 0,
    (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT));
    /* Fetch the data display status of indicator variables */
    do
    empno=0;
    status = OCIStmtFetch(stmthp3, errhp, 1, OCI_FETCH_NEXT, OCI_DEFAULT);
    if(status !=0 && status != 100)
    checkerr(errhp, status);
    if (status == OCI_SUCCESS)
    printf("Number %d selected with following status:\n", empno);
    printf(" indicator variables: MYNAME %5d, MYDESC %5d\n", ename_ind, mydesc_ind);
    printf(" length of data : MYNAME %5d, MYDESC %5d\n", ename_rlen, mydesc_rlen);
    } while (status==0);
    cleanup();
    /* Function checking for errors during an OCI call execution */
    void checkerr(errhp, status)
    OCIError *errhp;
    sword status;
    text errbuf[512];
    sb4 errcode = 0;
    switch (status)
    case OCI_SUCCESS:
    break;
    case OCI_SUCCESS_WITH_INFO:
    (void) printf("Error - OCI_SUCCESS_WITH_INFO\n");
    break;
    case OCI_NEED_DATA:
    (void) printf("Error - OCI_NEED_DATA\n");
    break;
    case OCI_NO_DATA:
    (void) printf("Error - OCI_NODATA\n");
    break;
    case OCI_ERROR:
    (void) OCIErrorGet((dvoid *)errhp, (ub4) 1, (text *) NULL, &errcode,
    errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
    (void) printf("Error - %.*s\n", 512, errbuf);
    break;
    case OCI_INVALID_HANDLE:
    (void) printf("Error - OCI_INVALID_HANDLE\n");
    break;
    case OCI_STILL_EXECUTING:
    (void) printf("Error - OCI_STILL_EXECUTE\n");
    break;
    case OCI_CONTINUE:
    (void) printf("Error - OCI_CONTINUE\n");
    break;
    default:
    break;
    * Exit program with an exit code.
    void cleanup()
    if (stmthp2)
    checkerr(errhp, OCIHandleFree((dvoid *) stmthp2, OCI_HTYPE_STMT));
    if (stmthp1)
    checkerr(errhp, OCIHandleFree((dvoid *) stmthp1, OCI_HTYPE_STMT));
    if (errhp)
    (void) OCIServerDetach( srvhp, errhp, OCI_DEFAULT );
    if (srvhp)
    checkerr(errhp, OCIHandleFree((dvoid *) srvhp, OCI_HTYPE_SERVER));
    if (svchp)
    (void) OCIHandleFree((dvoid *) svchp, OCI_HTYPE_SVCCTX);
    if (errhp)
    (void) OCIHandleFree((dvoid *) errhp, OCI_HTYPE_ERROR);
    return;
    /* Convert a buffer to unicode using OCICharSetToUnicode function */
    size_t mytxt2uni(dvoid envhp, utext dst, size_t dstlen,
    CONST text * src, size_t srclen)
    size_t cconv; /* Number of characters converted */
    sword ret;
    if ((ret=OCICharSetToUnicode(envhp, dst, dstlen, src, srclen, &cconv))
    != OCI_SUCCESS)
    fprintf(stderr,"\nError in mytxtuni (ret = %d)\n", ret);
    exit(1);
    return cconv;
    /* Convert a unicode buffer to text using OCIUnicodeToCharSet */
    size_t myuni2txt(dvoid envhp, text dst, size_t dstlen,
    CONST utext * src, size_t srclen)
    size_t bconv;
    sword ret;
    if ((ret=OCIUnicodeToCharSet(envhp, dst, dstlen, src, srclen, &bconv))
    != OCI_SUCCESS)
    fprintf(stderr, "\nError in myuni2txt (ret = %d)\n", ret);
    exit(1);
    /* Check for usage of replacement character during conversion */
    if (OCICharSetConversionIsReplacementUsed((dvoid*)envhp))
    fprintf(stderr, "\nWarning: Replacement character used during conversion!\n");
    return bconv;
    }

  • Migration key w/ unicode conversion only

    hello - i'm doing a unicode conversion of a NW04 system, following the Unicode conversion guide point by point for the proces. 
    source:  nw04 / ora10202 / hpux ia64 (non-unicode)
    target:  nw04 / ora10202 / hpux ia64 (unicode)
    the import is failing bc it says the migration key is not good.  the guide didn't even mention the need for the key and i was not expecting to have to use one since the OS/DB remain the same on the target system.  any ideas?
    ==
    from the MIGKEY.log file -
    /sapmnt/LH7/exe/R3load: sccsid @(#) $Id: //bas/640_REL/src/R3ld/R3load/R3ldmain.c#6 $ SAP
    /sapmnt/LH7/exe/R3load: version R6.40/V1.4 [UNICODE]
    /sapmnt/LH7/exe/R3load -dbcodepage 4102 -i /tmp/sapinst_instdir/NW04/COPY/IMPORT/SYSTEM/ABAP/ORA/UC/DB/SAPUSER.cmd -l MIGKEY.log -K 
    DbSl Trace: OCI-call 'OCIServerAttach' failed: rc = 12154
    DbSl Trace: CONNECT failed with sql error '12154'

    Hi Ben,
    This looks more like a Oracle Error and not a Migration key related error.
    I think its TNS Related, please check the following URL:
    /thread/361384 [original link is broken]

  • Unicode app on Win32 platform: What should the client locale be?

    You probably have solved one of my biggest mystery when you say there is no UTF8 Win32 codepage. I am using Windows 2000 with Oracle 8i OCI. I used Win32 API putenv() to set NLSCHARACTERSET to UTF8 in my Unicode-16 application. However, all the accented character insertions from my application, such as @, have been corrupted when they get through the OCI calls.
    What client locale should I set to? My app is supposed to support Oracle Server with character set WE8ISO8859P1, UTF8, JA16EUC and JA16SJIS. Originally I thought setting my app to NLS_CHARACTERSET to UTF8 would solve all the encoding and transcoding problem. Please advise. Thank you!
    Regards, Nancy.
    null

    Hi Nancy,
    I need a few clarifications. You mentioned your app is supposed to support Oracle Server with character set
    WE8ISO8859P1, UTF8, JA16EUC and JA16SJIS. Are you saying that the database character set might be any of 4 you list? Is your app 3 tier? Can a web browser call it? More details would be appreciated, and I will do my best to help. I would like you to take a look at a particular paper: "Migrating Oracle Internet Applications to Support Unicode" at
    http://technet.oracle.com/products/oracle8i/
    There are specific sections on OCI programming that I think fit your scenario. Take a look around page 30.
    null

  • OCI, 64-bit and C++ in Oracle 8.1.7?

    Hi,
    In the provided demo makefile (demo_rdbms.mk) for OCI on
    Oracle 8.1.7 a comment says:
    # 64-bit OCI programs in C are supported but
    # 64-bit external procedures and 64-bit OCI programs in C++ are
    # NOT supported.
    Will NOTHING work or are some functionality possible?
    I want to mix ProC/C++ with OCI with the use of sql2oci
    in a single threaded C++ application.
    (More specific I want to use direct path streams).
    Any suggestions?
    br
    /Johan Fall

    The National Character Set in 8i was only meant to support a few special Asian character sets. Though it is set to whatever you set the database to the NCHAR columns will not work properly for UTF8. You will need to use SQL CHAR fields in order to support UTF8 in 8i. And the semantics are byte. In Oracle9i the National Character Set exclusively supports Unicode via the character sets UTF8 and Al16UTF16. The default is Al16UTF16 which is UTF-16. The 9i NCHAR fields are character semantics so field(5) would be 5 characters not bytes. There are a couple of papers on our home page that talk about unicode support at:
    http://technet.oracle.com/tech/globalization/content.html
    Oracle Unicode Database Support
    Migration to Unicode Datatypes for Multilingual Databases and Applications in Oracle9i

  • Unicode i/o with OCI9

    Hi,
    Win2k OS
    I am trying to build an appln in VC using OCI9 so as to work with unicode data(Devnagari-Hindi).
    Case I :
    Client : oracle815 (NLS_LANG=UTF8)
    server : oracle815 (NLS_NCHAR_CHARACTERSET=UTf8)
    If i w'd use NCHAR sql datatypes to work with unicode data, then i can successfully insert/retrieve hindi data into/from Oracle815 DB. (e.g. a Hindi char with hex code 05 09 is inserted as e0 a4 85 in Database and retrieved as e0 a5 85 which u need to convert it back to unicode using multibytetowidechar())
    Case II :
    Client : oracle815 or 912 (NLS_LANG=UTF8)
    server : oracle912 (NLS_NCHAR_CHARACTERSET=UTf8)
    In this case(ora815 client), If i w'd follow the same operation as in case I, then i dont get proper result after fetch. (e.g. a Hindi char with hex code '05 09' is inserted as 'e0 a4 85' in Database, BUT it is not retrieved back as 'e0 a5 85', but as '60 24 05'.
    And if i w'd use ora912 client, then i get the result as '3F' for the same above character.
    What's wrong in my program or settings.?
    Plus, my another requirement is, i dont want to change NLS_LANG parameter in registry manually, but, i w'd like change it programmaticaly thru OCI. For this, i tried using OCI funct OCIEnvNlsCreate(..., csid, ncsid). I set the last two parameters to OCI_UTF16ID(The header oci.h has the only constant OCI_UTF16ID defined !. We cant use any other charsetID like UTF8 or what ?), then, i get an error 'ORA-12154: TNS: Could not resolve service name'.
    What am i missing here.?
    TIA,
    regards,
    Virupaksh

    A sandbox security feature prevents unsigned applets from accessing your filesystem. For more information see:
    http://java.sun.com/docs/books/tutorial/security1.2/tour1/index.html
    or this forum:
    http://forum.java.sun.com/thread.jsp?thread=221840&forum=63&message=1977008

  • Character Unicode Value

    Is it possible to have a VB script return the unicode values for a given range of characters in a paragraph or story?

    We tried it on a 8.1.7 database and I was not able to reproduce
    the error.
    Here is how I insert and retrieve the data:
    OraclePreparedStatement ps =
    (OraclePreparedStatement) conn.prepareStatement
    ("insert into tab01 values (?)");
    ps.setString(1, "\u2018");
    ps.executeUpdate();
    ps.close();
    ResultSet rs = (conn.createStatement()).executeQuery("select col01
    from tab01");
    while(rs.next())
    String str = rs.getString(1);
    System.out.println("COL01 is "+str);
    showUnicode("COL01 (Unicode Value) is "+str);
    (conn.createStatement()).close();
    conn.close();
    And here is the result from the database:
    SQL> select dump(col01, 16) from tab01;
    DUMP(COL01,16)
    Typ=1 Len=3: e2,80,98
    Are you using thin driver or oci driver?
    If oci driver is used, NLS_LANG needs to be set correctly and
    the Client OS code page must support these characters. Hope this
    helps.

  • Error while creating a report that uses Oracle OCI JDBC connectivity

    Please let me know why my CR and LF characters are removed from my forum posting *****
    Hi,
    I was trying to create a report that uses Oracle OCI JDBC connectivity. I am using Eclipse3.4 download from "cr4e-all-in-one-win_2.0.2.zip".  I have successfully created a JDBC OCI connection.
    The connection parameters are given below:
    URL: jdbc:oracle:oci8:@xe
    Database: xe
    username: <userName>
    password: <password>
    I have tested the above connection in Data source Explorer and it works fine!!!
    But I am getting the following error when I drag-and-drop a table from the list of tables. Not sure what I am missing here?  Any help is highly appreciated.
    com.businessobjects.reports.jdbinterface.common.DBException: InvalidURLOrClassName
         at com.crystaldecisions.reports.queryengine.driverImpl.jdbc.JDBCConnection.Open(Unknown Source)
         at com.crystaldecisions.reports.queryengine.JDBConnectionWrapper.Open(SourceFile:123)
         at com.crystaldecisions.reports.queryengine.Connection.br(SourceFile:1771)
         at com.crystaldecisions.reports.queryengine.Connection.bs(SourceFile:491)
         at com.crystaldecisions.reports.queryengine.Connection.t1(SourceFile:2979)
         at com.crystaldecisions.reports.queryengine.Table.u7(SourceFile:2408)
         at com.crystaldecisions.reports.dataengine.datafoundation.AddDatabaseTableCommand.new(SourceFile:529)
         at com.crystaldecisions.reports.common.CommandManager.a(SourceFile:71)
         at com.crystaldecisions.reports.common.Document.a(SourceFile:203)
         at com.businessobjects.reports.sdk.requesthandler.f.a(SourceFile:175)
         at com.businessobjects.reports.sdk.requesthandler.DatabaseRequestHandler.byte(SourceFile:1079)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(SourceFile:1163)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:657)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(SourceFile:163)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(SourceFile:525)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(SourceFile:523)
         at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
         at java.util.concurrent.FutureTask.run(Unknown Source)
         at com.businessobjects.crystalreports.designer.core.util.thread.ExecutorWithIdleProcessing$3.doWork(ExecutorWithIdleProcessing.java:182)
         at com.businessobjects.crystalreports.designer.core.util.thread.AbstractCancellableRunnable.run(AbstractCancellableRunnable.java:69)
         at com.businessobjects.crystalreports.designer.core.util.thread.PriorityTask.run(PriorityTask.java:75)
         at com.businessobjects.crystalreports.designer.core.util.thread.PriorityCompoundCancellableRunnable.runSubtask(PriorityCompoundCancellableRunnable.java:187)
         at com.businessobjects.crystalreports.designer.core.util.thread.PriorityProgressAwareRunnable.runSubtask(PriorityProgressAwareRunnable.java:90)
         at com.businessobjects.crystalreports.designer.core.util.thread.PriorityCompoundCancellableRunnable.doWork(PriorityCompoundCancellableRunnable.java:144)
         at com.businessobjects.crystalreports.designer.core.util.thread.AbstractCancellableRunnable.run(AbstractCancellableRunnable.java:69)
         at com.businessobjects.crystalreports.designer.core.util.thread.ExecutorWithIdleProcessing$IdleTask.run(ExecutorWithIdleProcessing.java:320)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Thanks
    Karthik
    Edited by: KARTHIK1 on Oct 14, 2009 9:38 PM

    Hi Ted,
    Thanks for the feedback. I was able to create a report in Creystal Reports Designer 2008 using OCI.  It is not allowing only in the Eclipse plugin. In our environment we are not allowed to user Oracle thin connections and ONLY OCI is allowed.
    1) Can you please let me know if there is a way to do this? 
    2) Will it allow data sources using native database driver?
    3) If so, can I use JRC to create these reports from a desktop java program?
    Thanks & Regards
    Karthik
    Edited by: KARTHIK1 on Oct 15, 2009 4:38 PM

Maybe you are looking for