MULTI_TREADING with OCI

Hi everyone,
We do the following in an OCI program :
1. The environment is properly initialized with OCI_THREADED (and without OCI_ENV_NO_MUTEX).
2. Two threads A and B are involved.
3. Thread A creates and properly sets up a service context handle and a session handle.
4. Both threads A and B use the same service context and session handles (though never concurrently). This works fine.
5. At one point, thread A ends. Thread B continues to execute.
6. After A ends, thread B gets an OCI_INVALID_HANDLE when it attempts to use the service context and session handles.
7. Note that thread B would have closed the handles before ending, but does not have the chance to get that far.
Is that normal? Is it forbidden to share service context and user session handles amongst threads? The documentation strongly suggests otherwise.
We are using Oracle client 11G Release 1 and the server is also at the same version.
Best regards.
Carl

Do I have this right?
You want to start a Java application from the commandline, and this application creates multiple threads.
Each thread executes methods from the ProcessBuilder or Runtime classes, which opens a terminal (cmd) window, starts an external (non-Java) .exe program. The exe writes to the cmd window.
If that's correct, then you need to learn how to create a threaded program, and to use Either the ProcessBuilder or Runtime class.
Here's a how-to on creating threaded (concurrent) Java programs
http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html
and here's an article on correct use of the Runtime class
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

Similar Messages

  • Problem to create data source with OCI type of driver

    Hi Experts
    We are creating an XA datasource with OCI type of driver using an enterprise application with data-sources.xml, the xml is like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE data-sources SYSTEM "data-sources.dtd" >
    <data-sources>
         <data-source>
              <data-source-name>OCI_DS_XA</data-source-name>
              <driver-name>ORACLE_DRIVER</driver-name>
              <init-connections>1</init-connections>
              <max-connections>25</max-connections>
              <max-time-to-wait-connection>120</max-time-to-wait-connection>
              <expiration-control>
                   <connection-lifetime>60</connection-lifetime>
                   <run-cleanup-thread>300</run-cleanup-thread>
              </expiration-control>
              <sql-engine>Vendor_SQL</sql-engine>
              <jdbc-2.0>
                   <xads-class-name>
                        oracle.jdbc.xa.client.OracleXADataSource
                   </xads-class-name>
                   <object-factory>
                        oracle.jdbc.pool.OracleDataSourceFactory
                   </object-factory>
                   <properties>
                        <property>
                             <property-name>serverName</property-name>
                             <property-value><SERVER_NAME></property-value>
                        </property>
                        <property>
                             <property-name>serverPort</property-name>
                             <property-value>1521</property-value>
                        </property>
                        <property>
                             <property-name>databaseName</property-name>
                             <property-value>ORCL</property-value>
                        </property>
                        <property>
                             <property-name>driverType</property-name>
                             <property-value>oci</property-value>
                        </property>
                        <property>
                             <property-name>user</property-name>
                             <property-value>username</property-value>
                        </property>
                        <property>
                             <property-name>password</property-name>
                             <property-value>password</property-value>
                        </property>
                   </properties>
              </jdbc-2.0>
              </data-source>
    </data-sources>
    We have installed oracle client in server M/C and configured all the environment variables. While we are deploying the application from CE developer studio IDE to the CE 7.1 AS, we are getting the  following error:
    Description:
              1. Exception has been returned while the 'sap.com/DS_TEST_EAR' was starting. Warning/Exception :
    [ERROR CODE DPL.DS.6193] Error while ; nested exception is:
         com.sap.engine.services.deploy.exceptions.ServerDeploymentException: [ERROR CODE DPL.DS.5030] Clusterwide exception: server ID 7653550:com.sap.engine.services.dbpool.exceptions.BaseDeploymentException: Cannot create DataSource "OCI_DS_XA".
         at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSources(ContainerImpl.java:1467)
         at com.sap.engine.services.dbpool.deploy.ContainerImpl.prepareStart(ContainerImpl.java:468)
         at com.sap.engine.services.deploy.server.application.StartTransaction.prepareCommon(StartTransaction.java:219)
         at com.sap.engine.services.deploy.server.application.StartTransaction.prepare(StartTransaction.java:179)
         at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:419)
         at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesImpl(ParallelAdapter.java:495)
         at com.sap.engine.services.deploy.server.application.StartTransaction.makeAllPhasesImpl(StartTransaction.java:554)
         at com.sap.engine.services.deploy.server.application.ParallelAdapter.runInTheSameThread(ParallelAdapter.java:248)
         at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesAndWait(ParallelAdapter.java:389)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3387)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3373)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3276)
         at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3249)
         at com.sap.engine.services.dc.lcm.impl.J2EELCMProcessor.doStart(J2EELCMProcessor.java:99)
         at com.sap.engine.services.dc.lcm.impl.LifeCycleManagerImpl.start(LifeCycleManagerImpl.java:62)
         at com.sap.engine.services.dc.cm.deploy.impl.LifeCycleManagerStartVisitor.visit(LifeCycleManagerStartVisitor.java:34)
         at com.sap.engine.services.dc.cm.deploy.impl.DeploymentItemImpl.accept(DeploymentItemImpl.java:83)
         at com.sap.engine.services.dc.cm.deploy.impl.DefaultDeployPostProcessor.postProcessLCMDeplItem(DefaultDeployPostProcessor.java:80)
         at com.sap.engine.services.dc.cm.deploy.impl.DefaultDeployPostProcessor.postProcess(DefaultDeployPostProcessor.java:56)
         at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.doPostProcessing(DeployerImpl.java:741)
         at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.performDeploy(DeployerImpl.java:732)
         at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.doDeploy(DeployerImpl.java:576)
         at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.deploy(DeployerImpl.java:270)
         at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.deploy(DeployerImpl.java:192)
         at com.sap.engine.services.dc.cm.deploy.impl.DeployerImplp4_Skel.dispatch(DeployerImplp4_Skel.java:875)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:351)
         at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:70)
         at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:62)
         at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:37)
         at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:872)
         at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:53)
         at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:58)
         at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108)
         at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:304)
    Caused by: com.sap.engine.frame.core.database.DatabaseException: Exception of type java.sql.SQLException occurred: Closed Connection.
         at com.sap.engine.core.database.impl.DataSourceAdministratorImpl.createDataSource(DataSourceAdministratorImpl.java:49)
         at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSources(ContainerImpl.java:1400)
         ... 33 more
    Caused by: java.sql.SQLException: Closed Connection
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
         at oracle.jdbc.driver.GetCharSetError.processError(T2CConnection.java:3082)
         at oracle.jdbc.driver.T2CConnection.getCharSetIds(T2CConnection.java:2811)
         at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:300)
         at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:344)
         at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:136)
         at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:79)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:545)
         at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:194)
         at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:121)
         at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:333)
         at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:84)
         at com.sap.sql.connect.factory.XADSPooledConnectionFactory.getPooledConnection(XADSPooledConnectionFactory.java:27)
         at com.sap.sql.connect.datasource.DBDataSourceImpl.createPooledConnection(DBDataSourceImpl.java:677)
         at com.sap.sql.connect.datasource.DBDataSourcePoolImpl.initConnections(DBDataSourcePoolImpl.java:1099)
         at com.sap.sql.connect.datasource.DBDataSourcePoolImpl.<init>(DBDataSourcePoolImpl.java:49)
         at com.sap.sql.connect.datasource.DataSourceManager.createDataSource(DataSourceManager.java:507)
         at com.sap.sql.connect.datasource.DataSourceManager.createDataSource(DataSourceManager.java:136)
         at com.sap.sql.manager.OpenSQLManager.createDataSource(OpenSQLManager.java:141)
         at com.sap.engine.core.database.impl.DataSourceAdministratorImpl.createDataSource(DataSourceAdministratorImpl.java:42)
         ... 34 more
    But when we are creating the datasource with thin type of driver, it is working fine. We have already created a driver with name “ORACLE_DRIVER” in server using the ojdbc14.jar using Netweaver administrator consol.
    Same this is happening when we are creating the OCI type of datasource by using Netweaver administrator consol by specifying all the parameter as above and also the initial connection pool size is more than zero.
    Same thing is happening for normal (JDBC 1x) datasource creation with OCI type driver.

    Hello,
    I ran a search on SDN, related to your error code, i found the following:
    UnsupportedClassVersionError in NWDS CE
    DeploymentWarning-WebService-Collection
    Maybe its useful to you
    Regards,
    Siddhesh

  • 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

  • How do I get XSQL Servlet to work with OCI 9i

    I'm using the most recent jdbc driver (ojdbc14.jar) that works with jdk 1.4. I'm using a 9.0.1 db, and I'm using xdk for java 9.2.0.3. If I specify an oci driver in the XSQLConfig.xml file, I get the following error with a xsql:query request:
    Oracle XDK Java 9.2.0.3.0 Production
    XSQL-017: Unexpected Error Occurred
    java.lang.UnsatisfiedLinkError: no ocijdbc8 in java.library.path
    Now why does XDK insist to look for ocijdbc8 if I only have ocijdbc9.dll installed on my client? The config file only allows oci8 in the dburl specification, which is probably why XDK insists to look for ocijdbc8, but I CANNOT specify oci9, which would make sense to me, although it's most likely not a valid specification.
    <connection name="9ic">
    <username>scott</username>
    <password>tiger</password>
    <dburl>jdbc:oracle:oci8:@</dburl>
    <driver>oracle.jdbc.OracleDriver</driver>
    <autocommit>true</autocommit>
    </connection>
    So how do get XSQL Servlet to work with OCI 9i?

    If you are using the latest Oracle9i JDBC driver, which you should be able to get from OTN, it should look for the DLL with 9 in the name.
    Perhaps you have a "stale" JDBC driver somewhere earlier on the classpath?
    Steve Muench
    JDeveloper/BC4J Development Team
    Author, Building Oracle XML Applications

  • Is it possible to working in Java Stored Procedures with OCI driver?

    Hello ALL.
    Could you help me...
    Is it possible to working in Java Stored Procedures with OCI driver?
    I want to try to do some workaround...
    I need to work with following parametrs from Java Stored Procedures:
    DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
    String url = null;
    url = "jdbc:oracle:oci:@TEST";
    conn = DriverManager.getConnection (url,"scott","tiger");
    Is it possible?
    I tried but I have errors...
    Please, help me!
    Thanks

    You cannot call OCI functions directly from PL/SQL. You could, of course, write an external procedure that made OCI calls, though you could also write an external procedure in Java. I'm guessing the documentation is trying to convey this same information-- you would need an external procedure that used OCI if you wanted to use the old-school interfaces for LONG and LOB data types. If you converted to using LOBs rather than LONGs, you could do everything in PL/SQL.
    Justin

  • Oracle Client Installation 11.2.0.2 with OCI libraries

    Hi All,
    I need to install Oracle Client 11.2.0.2 with OCI libraries. How to install the OCI libraries, where can I find the install files for OCI.
    Thank you

    Hi;
    Please see:
    Want  to download OCI libraries Oracle 9.2
    Also see:
    Master Note for Precompilers, OCI and OCCI [ID 1129588.1]
    Regard
    Helios

  • Waits with OCI calls

    I have a C++ app which access Oracle DB 10.1.0.4 via OCI from Linux redhat.
    I have extensive waits between the app and the database.
    How can I torubleshoot this problems?
    Etherial show waits on the DB before to send it back to the app. but the execution time for the quesries do not cover the waiting time - like wait 1/2 sec, query runs for 22 millisec.
    How can I figure out what is waiting and why?
    Thanks,mj

    Hi,
    The whole problem is, I don't have access to the code which uses OCI. I cannot modify the code to set CURSOR_SHARING=FORCE, as it is third party code.
    Is it possible to achieve the same with some setting in some configuration file?
    E.g. if you have a glogin.sql file in $ORACLE_HOME/sqlplus/admin, every time you run sqlplus, after you login, this glogin.sql file will be executed automatically
    Is any such thing possible with OCI programs? i.e. when a program using OCI starts running using certain client installation, we want to run some commands.
    If that can be achieved, my problem is sorted.

  • Building gdal with OCI support- seems to work manually, not in makepkg

    I'm attempting to rebuild the gdal package under x86_64 with Oracle Spatial support at the latest version (1.9.2) (the version in community is at 1.9.0 right now and does not include Oracle support).
    gdal uses the standard autoconf/automake toolchain for its build process, and allows users to specify which external libraries they want to link in the configure script.  To enable Oracle Spatial support in gdal, one would pass the --with-oci option to configure.  This works fine for me and detects the contents of my oracle-instantclient-basic and oracle-instantclient-sdk packages (aur packages containing the necessary Oracle libs and headers) when I do it manually, i.e.:
    ./configure --prefix=/usr --with-netcdf --with-libtiff --with-sqlite3 \
    --with-geotiff --with-mysql --with-python --without-libtool --with-curl \
    --with-hdf5 --with-perl --with-geos --with-png \
    --with-oci
    However, when the exact same line runs inside of the build() function of a makepkg run, the configure script fails to detect the OCI libraries.  I know that the configure script is supposed to work by reading the ORACLE_HOME environment variable to find the necessary Oracle libraries and headers, and I've double-checked that this environment variable is being set properly inside of the makepkg run with a couple of echo statements before the configure line is run. 
    Is there something else that I could be missing about the environment variables or build context inside of makepkg that could be causing this?  I've already looked through /etc/makepkg.conf and couldn't find anything that would seem to make a difference, but I'll readily admit that I don't have a ton of knowledge about the autotools library detection process other than the fact that I've built a few packages with the toolchain.
    Any help/ideas would be greatly appreciated.  Here's the PKGBUILD I'm using if you want to try it for yourself (based off of gdal 1.9.0-1 in community): https://gist.github.com/3920468

    I'm attempting to rebuild the gdal package under x86_64 with Oracle Spatial support at the latest version (1.9.2) (the version in community is at 1.9.0 right now and does not include Oracle support).
    gdal uses the standard autoconf/automake toolchain for its build process, and allows users to specify which external libraries they want to link in the configure script.  To enable Oracle Spatial support in gdal, one would pass the --with-oci option to configure.  This works fine for me and detects the contents of my oracle-instantclient-basic and oracle-instantclient-sdk packages (aur packages containing the necessary Oracle libs and headers) when I do it manually, i.e.:
    ./configure --prefix=/usr --with-netcdf --with-libtiff --with-sqlite3 \
    --with-geotiff --with-mysql --with-python --without-libtool --with-curl \
    --with-hdf5 --with-perl --with-geos --with-png \
    --with-oci
    However, when the exact same line runs inside of the build() function of a makepkg run, the configure script fails to detect the OCI libraries.  I know that the configure script is supposed to work by reading the ORACLE_HOME environment variable to find the necessary Oracle libraries and headers, and I've double-checked that this environment variable is being set properly inside of the makepkg run with a couple of echo statements before the configure line is run. 
    Is there something else that I could be missing about the environment variables or build context inside of makepkg that could be causing this?  I've already looked through /etc/makepkg.conf and couldn't find anything that would seem to make a difference, but I'll readily admit that I don't have a ton of knowledge about the autotools library detection process other than the fact that I've built a few packages with the toolchain.
    Any help/ideas would be greatly appreciated.  Here's the PKGBUILD I'm using if you want to try it for yourself (based off of gdal 1.9.0-1 in community): https://gist.github.com/3920468

  • Running OCCI 12.1 with OCI 11.2

    Hi there.
    A quick newbie question: can I compile and link my apps with OCCI 12.1 (oraocci12.dll) and have it run on top of OCI 11.2 (oci.dll) ?
    I'm not using any advanced OCI features.
    Thanks in advance!

    4f2b8813-c251-4b48-8f2b-242dc36d4904 wrote:
    A quick newbie question: can I compile and link my apps with OCCI 12.1 (oraocci12.dll) and have it run on top of OCI 11.2 (oci.dll) ?
    I'm not using any advanced OCI features.
    Not sure what you mean... oraocci12.dll depends on oci.dll, so you are implicitly using OCI when you use OCCI.
    But I was told by Oracle (a few years back, about 11gR1 at the time) that you cannot mix OCCI with OCI, despite having accessors to the raw OCI handles from OCCI. OCCI sometimes lag in its support of feature that first come out first for OCI, like it used to for 64-bit LOB sizes, or XMLTYPE support, etc... Since those limitations of OCCI made us invest in the lower-level OCI, I haven't followed up on OCCI much.
    Another drawback of OCCI versus OCI is that since OCCI is C++, you must always wait (sometimes for months) for Oracle to provide you with a version compiled with the latest Visual Studio, whereas OCI as a C library can be used with any VS versions.
    But otherwise OCCI is great, much simpler that OCI. By all means use OCCI if it covers all the features (and VS versions) you want to use. --DD

  • Procedure output parameter with OCI

    Hi everyone,
    Is it possible to get the value of an output parameter calling a procedure with OCI?
    Regards.
    Carl

    yes, with a bind.
    prepare "begin myproc( :outvar ); end;"
    bindbyname outvar
    execute

  • Using Two-Phase Commits and Data Sources does not work with OCI

    Hi,
    i tried to configure 2pc with OCI.
    when i use thin like shown in :
    http://download-west.oracle.com/docs/cd/B14099_19/web.1012/b14012/datasrc.htm#sthref578
    everything works.
    If i change the url from thin -> oci
    the transaction is rolled back.
    The documentation says
    http://download-west.oracle.com/docs/cd/B14099_19/web.1012/b14012/datasrc.htm#i1085507
    for using oci. But if i use this in thin mode, it breaks even the thin mode.... ;-(
    Can anybody help?

    It is fixed in 10.1.3

  • After connection lost SetVector fails with OCI-22303: type not found

    Hi there,
    I use statelessConnectionPool and after application is loosing connection to oracle for short time, all folowing setVector calls will fail with
    SetVector fails with OCI-22303: type "DEMO"."PROPERTIES" not found
    however its there and was working fine before connection was lost,
    As far as i read about the getConection for statelessConnectionPool will reestablish connection if required to return valid connection handle, but somehow the setVector does not work.
    Any idea?
    Thanks in advance
    Andrew

    Hi,
    I want to reconnect to same instance, I think i missed tnsnames part, did not knew its required, so i should add to client tnsnames or server the FAILOVER_MODE part?
    like this example:
    PAYROLL =
    (DESCRIPTION =
    (ADDRESS =
    (COMMUNITY = TCP.world)
    (PROTOCOL = TCP)
    (HOST = VSERVER)
    (PORT = 1521)
    (CONNECT_DATA =
    (SID = HR)
    (FAILOVER_MODE =
    (TYPE = SELECT)
    (METHOD = BASIC)
    (RETRIES = 20)
    (DELAY = 15)
    strange thing that connection seams to be valid only in complains about type not found, or maybe connections are not valid only i cant see it, does the not valid connections in the pool are reconnected or make new when i call GetConnection? or i should terminate connections on "end of comm channel error" so when db is reachable again it will reestablish new connections?
    Andrew

  • GCC compatibility with  OCI

    OCI states that it supports 4.1 and I am using GCC 4.5 . Any idea if the two are compatible if not ?? What should i do any help would be appreciated...

    Hi Mac,
    I am also using OCI with C.
    Can you please post or email me your makefile , I am getting ORA-6521 : error mapping function. So there seems to be a problem with the way I am generating custagg.so file. Can you please post your makefile. So that I can generate my shared library properly.
    This is how I am generating my shared library:
    I am compiling my C program with OCI using the following command :
    g++ -Wall -c custagg.c -o custagg.o -I$ORACLE_HOME/rdbms/public -I/usr/lib
    I am linking to get a shared library custagg.so file with following command :
    ld -shared -o custagg.so custagg.o $ORACLE_HOME/lib/l*.so ../../usr/lib/libstdc++.s*
    I am not getting any errors during these two phases.
    And when i am calling the extproc custagg(Mindistance) which i implemented using ODCI(oracle data catridge interface) ...I am getting the error undefined symbol : ODCIAggregateInitialize
    If, in case you what shared libraries are required to access the ODCI services and also am I compiling and linking it the right way or am I missing any libraries.
    I have the oci.h & odci.h and several other header files in my :
    $ORACLE_HOME/rdbms/public
    And while linking i am using : $ORACLE_HOME/lib/*.so files.
    So I don't know whether my directory is missing some shared files related to ODCI :
    can you please let me know which files or shared libraries I am missing :
    These are the errors which i am getting :
    ERROR at line 1:
    ORA-06521: PL/SQL: Error mapping function
    ORA-06522: /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/custagg.so:
    undefined symbol: ODCIAggregateInitialize

  • Pthread threads with OCI

    Hi.
    How can I use pthread threads with OCI?
    When I'm just trying to call OCIEnvCreate I get segfault.

    I have 10 threads with the following code:
    OCIEnv *envhp;
    OCIServer *srvhp;
    OCISvcCtx *svchp;
    OCISession *authp;
    OCIStmt *stmthp = (OCIStmt *) NULL;
    OCIError *errhp;
        /* Initialize the mode to be the threaded and object environment */
        if (OCIEnvCreate((OCIEnv **) &envhp, OCI_THREADED | OCI_OBJECT, (dvoid *)0,
                         0, 0, 0, (size_t) 0, (dvoid **) 0)) {
            printf("%s\n", "FAILED: OCIEnvCreate()");
        /* Allocate a service handle */
        if (OCIHandleAlloc((dvoid *) envhp, (dvoid **) &svchp,
                           OCI_HTYPE_SVCCTX, (size_t) 0, (dvoid **) 0)) {
            syslog(LOG_ERR, "FAILED: OCIHandleAlloc() on svchp\n");
        /* Allocate an error handle */
        if (OCIHandleAlloc((dvoid *) envhp, (dvoid **) &errhp,
                           OCI_HTYPE_ERROR, (size_t) 0, (dvoid **) 0)) {
            syslog(LOG_ERR, "FAILED: OCIHandleAlloc() on errhp\n");
        /* Allocate a server handle */
        if (OCIHandleAlloc((dvoid *) envhp, (dvoid **) &srvhp,
                           OCI_HTYPE_SERVER, (size_t) 0, (dvoid **) 0)) {
            syslog(LOG_ERR, "FAILED: OCIHandleAlloc() on srvhp\n");
        /* Allocate a authentication handle */
        if (OCIHandleAlloc((dvoid *) envhp, (dvoid **) &authp,
                           OCI_HTYPE_SESSION, (size_t) 0, (dvoid **) 0)) {
            syslog(LOG_ERR, "FAILED: OCIHandleAlloc() on authp\n");
        /* Attach to the database server */
        if (OCIServerAttach(srvhp, errhp, (text *)dbname,
                            strlen(dbname), 0)) {
            syslog(LOG_ERR, "FAILED: OCIServerAttach()\n");
        /* Set the server handle in the service handle */
        if (OCIAttrSet((dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX,
                       (dvoid *) srvhp, (ub4) 0, (ub4) OCI_ATTR_SERVER, errhp)) {
            syslog(LOG_ERR, "FAILED: OCIAttrSet() server attribute\n");
        /* Logon to the server and begin a session */
        /* Set attributes in the authentication handle */
        if (OCIAttrSet((dvoid *) authp, (ub4) OCI_HTYPE_SESSION,
                       (dvoid *) dbuser, (ub4) strlen(dbuser),
                       (ub4) OCI_ATTR_USERNAME, errhp)) {
            syslog(LOG_ERR, "FAILED: OCIAttrSet() userid\n");
        if (OCIAttrSet((dvoid *) authp, (ub4) OCI_HTYPE_SESSION,
                       (dvoid *) dbpass, (ub4) strlen(dbpass),
                       (ub4) OCI_ATTR_PASSWORD, errhp)) {
            syslog(LOG_ERR, "FAILED: OCIAttrSet() passwd\n");
        if (OCISessionBegin(svchp, errhp, authp, OCI_CRED_RDBMS, OCI_DEFAULT)) {
            syslog(LOG_ERR, "FAILED: OCIAttrSet() passwd\n");
        /* Set the authentication handle in the Service handle */
        if (OCIAttrSet((dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX,
                       (dvoid *) authp, (ub4) 0, (ub4) OCI_ATTR_SESSION, errhp)) {
            syslog(LOG_ERR, "FAILED: OCIAttrSet() session\n");
            sb4 errcode = 0;
            text errbuf[1024];
            (void) OCIErrorGet((dvoid *)errhp, (ub4) 1, (text *) NULL, &errcode,
                               errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
            syslog(LOG_ERR, "Error - %.*s\n", 1024, errbuf);
        /* Allocate a statement handle */
        if (OCIHandleAlloc((dvoid *)envhp, (dvoid **) &stmthp,
                           (ub4)OCI_HTYPE_STMT, (CONST size_t) 0, (dvoid **) 0)) {
            syslog(LOG_ERR, "FAILED: alloc statement handle\n");
    ...What did I do wrong?

  • Issues with OCI connection..

    I've been working on this for over a day, with infinite variations on the theme; but I cannot get a basic query to give back data. I've got the following code:
    <?
    $orcl = <<<OUT
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME = orcl)(INSTANCE_NAME = orcl)
    OUT;
    $oci = oci_connect('','',$orcl)
    or die('Connection error.');
    if(!$oci) {
         echo 'Connection error: ';
         if(oci_error($oci)) {
              $oerr = oci_error();
              echo $oerr['code'];
         die;
    echo '<p>Initiated connection.</p>';
    $input = <<<OUT
         select * from user_objects
         where object_name not like '%SYS_%'
         order by object_name;
    OUT;
    $query = oci_parse($oci, $input);
    if(!$query) {
         $oerr = oci_error($oci);
         echo $oerr['code'];
    if(oci_execute($query)) {
         while($output = oci_fetch_array($query)) {
              $object = $output['OBJECT_NAME'];
              echo $object . '
    } else {
         echo 'Issue occurred..';
    oci_close($oci);
    ?>
    If I open this in a browser, it gives back the following:
         Initiated connection.
         Issue occurred..
    In other words, this indicates to me that the connection is being created, but that the query itself isn't being parsed or executed correctly. I've changed various things, for instance inserting 'orcl' instead or $orcl in the oci_connect(), including environment variables, etc. etc.; but I've gotten no further than this with it.
    Interestingly, if I do 'php index.php' on the command line, I get an ORA-12557 error (why is the page giving back 'Initiated connection' if this is the case).
    Installed Oracle is 10g 10.1.0 on Windows, connection is local. Thanks very much for any input..

    Odd; but thank you.
    I generally do that in order to offset db interactions a bit from other code and it's never been an issue with postgres interactions; but in this case I changed that and it's working now. I'm off to look into why this is (I imagine oci_parse isn't into it while PEAR::DB or pg_query ignore it; but I'm not certain).
    In either case, thank you.

Maybe you are looking for

  • How do i only show photos as attachments in mail not display the  photo

    Hi I am trying to send some photos by mail on my MBP but instead of just listing as attachments the complete photos are being displayed. Can i prevent this from happening as it often results in the email being 10 ft long!!!!! Best Rgds Kev

  • Windows 7 Problem Bootcamp

    Ok so I have a 2009 27" IMac. I already had a OEM copy of Win 7 partitioned and running perfectly fine for months. Recently I was sent a message from Apple about needed to bring comp in to get a possible faulty HD swaped out. I bought a Time Capsule

  • Can't edit movie in QT Pro

    I have a mpg that I took on my digital camera. It plays fine in QT but the editing controls are not showing up as I roll over the timeline. Also when i import into iMovie, I get the video but there is no audio. This is a movie of my 4 month old which

  • I have my serial number and need to reinstall acrobat 10 software

    I have my serial number and need to reinstall acrobat 10 software

  • DSL, iPhoto, and Swapfiles

    I'm trying to troubleshoot a recent recurring problem with my DSL service...  Problem follows: Usually after editing a fair number of large photos on iPhoto (each RAW file is at least 17Mb before processing), my DSL service will be interrupted.  Ocas