New to OCI
hello,
I am new to OCI.
Could I use OCI to interface a C application with Oracle Database 10g?
If possible, how to do it?
What other stuffs do I need? like any drivers needed?
Thanks in advance.
Regards.
If you're not familiar with C programming, and not familiar with OCI, what lead you to choose that as your API? Can you describe your application requirements and what languages & API's you're familiar with?
Unless you're developing a trivial application, a couple of months strikes me as rather ambitious if you're trying to learn C and OCI along the way. If you have questions, you can certainly post them in this forum-- I'm not aware of any resources better than this forum and the OCI documentation for dealing with OCI. There are a number of sample OCI applications that ship with the Oracle client (the companion CD in 10g)-- studying those should help.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC
Similar Messages
-
Which OCI library to use for static linking with application on Unix, Linux
Hi Friends
I am new to OCI programming.
I am developing a C++ application that works on Windows 7 (32, 64 bit, VS-9) and Linux (32, 64 bit), with OCI-11.2.0.3 version and Oracle 10g Express edition.
I want to statically link OCI library in my application.
For Windows, I got oci.lib in the package: instantclient-sdk-nt-11.2.0.3.0.zip\instantclient_11_2\sdk\lib\msvc downloaded from [Instantclient download location.|http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html] .
But, the instanclient packages instantclient-basic-linux-11.2.0.3.0.zip & instantclient-sdk-linux-11.2.0.3.0.zip do not contain a static archive for OCI library.
These packages have only include files and following .so (shared libraries) for Linux:
libclntsh.so.11.1
libnnz11.so
libocci.so.11.1
libociei.so
libocijdbc11.so
Can someone please guide me, where can I find the static archive (possibly liboci.a or libociei.a) for OCI-11.2.0.3 - 32 & 64 bit?
Many thanks in advance for your time and kind guidance.
Best Regards,
-ganesYou need:
libclient11.a
libcore11.a
libgeneric11.a
libcommon11.a
libn11.a
libldapclnt11.a
libncrypt11.a
and others.
Actually, you can link to all *.a files in $ORACLE_HOME/lib
EXCEPT: libclntst11.a and libexpat.a -
OCI - Sample program works on Windows but gives error in Solaris ??
Hi,
I am new to OCI. I was trying the following sample program:
#include<iostream>
#include<conio.h>
#include<firstheader.h>
//#include<stdafx.h>
#include<string.h>
using namespace std;
class OCIClass
public:
OCIClass()
int p_bvi;
char p_sli[20];
int rc;
char errbuf[100];
int errcode;
const char *s;
printf("Hello\n");
string sql;
string sql2="select substr(ename,1,3) from emp where job='ANALYST'";
cout<<sql2;
//char sql[512];
int flag=0;
sql += "SELECT * from emp where job='";
if (flag==0)
sql += "MANAGER";
else
sql += "ANALYST";
sql += "'";
cout<<sql + "\n";
s=sql.c_str();
char* cstr = new char[sql.size()+1];
strcpy (cstr, sql.c_str());
char* cstr2 = new char[sql2.size()+1];
strcpy (cstr2, sql2.c_str());
sql=" ";
/* Initialize evironment */
rc=OCIEnvCreate((OCIEnv **)&p_env,(ub4)OCI_DEFAULT ,(void *)0, (void * (*)(void *, size_t))0,
(void * (*)(void *, void *, size_t))0,(void (*)(void *, void *))0,(size_t)0, (void **)0);
/* Initialize handles */
rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_err, OCI_HTYPE_ERROR,
(size_t) 0, (dvoid **) 0);
printf("Error handle allocated\n");
rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_svc, OCI_HTYPE_SVCCTX,
(size_t) 0, (dvoid **) 0);
printf("service handle allocated\n");
printf("Value of RC before Logon\n %d", rc);
/* Connect to database server */
rc = OCILogon(p_env, p_err, &p_svc, (OraText *)"scott", 5,(OraText *) "welcome", 7,(OraText *) "", 0);
printf("Value of RC after Logon\n %d", rc);
if (rc != 0) {
OCIErrorGet((dvoid *)p_err, (ub4) 1, (text *) NULL, &errcode, (OraText *)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
printf("Error - %s\n",errbuf);
printf("error");
//exit(8);
getch();
printf("Connect successful\n");
/* Allocate and prepare SQL statement */
rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_sql,
OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0);
rc = OCIStmtPrepare(p_sql, p_err, (OraText*) cstr,
(ub4) 37, (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT);
/* Bind the values for the bind variables
p_bvi = 10; /* Use DEPTNO=10
rc = OCIBindByName(p_sql, &p_bnd, p_err, (text *) ":x",
-1, (dvoid *) &p_bvi, sizeof(int), SQLT_INT, (dvoid *) 0,
(ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT);*/
/* Define the select list items */
rc = OCIDefineByPos(p_sql, &p_dfn, p_err, 1, (dvoid *) &p_sli,
(sword) 20, SQLT_STR, (dvoid *) 0, (ub2 *)0,
(ub2 *)0, OCI_DEFAULT);
/* Execute the SQL statment */
rc = OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 1, (ub4) 0,
(CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT);
while (rc != OCI_NO_DATA) { /* Fetch the remaining data */
printf("%s\n",p_sli);
rc = OCIStmtFetch(p_sql, p_err, 1, 0, 0);
printf("After fetch\n");
rc = OCILogoff(p_svc, p_err); /* Disconnect */
rc = OCIHandleFree((dvoid *) p_sql, OCI_HTYPE_STMT); /* Free handles */
rc = OCIHandleFree((dvoid *) p_svc, OCI_HTYPE_SVCCTX);
rc = OCIHandleFree((dvoid *) p_err, OCI_HTYPE_ERROR);
void main()
OCIClass c1;
getch();
The above program works on my Windows desktop. If I try this in Solaris, OCILogon fails and gives an error. If I check the value of rc, I find that it is -2. I can connect to the database using SQLPlus, but not through the program. Not sure how to debug this...
Any pointers ?
Thanks in advance,
mrkDid you make the required port entry in the /etc/services file? You will need to add the gateway service port there. Then try to run your program.
T00th -
How to represent Nested table as variable/Object in OCI
Hi All,
I'm new to OCI.
I've following nested table in my database.
Nested table:
create type type1 as object (name varchar2(20));
create type type2 as table of type1;
create table table1 (col1 varchar2(20), col2 type2) nested table col2 store as table2;
Can anyone help me to present col2 as C structure/typedef so as to use it with OCIDefineObject?You can have a look at Chapter 11 of the OCI Programmer's Guide. Look at the section Collections in it. You can represent the nested table as OCITable *. Further, you can generate structure representation of your object type by using OTT. Please let us know if this answers your question. In case you are not able to proceed please let us know.
Thanks,
Sumit -
New PDO drivers in PHP 5.1 leave much to be desired.
I used ADOdb for more then 2 years and was extremely satisfied with it, but decided to test-drive the new, unified, database interface. Here is a little script that I created:
#!/usr/local/bin/php
<?php
$SQL1="select * from emp where ename like :ENAME";
$name='%';
try { $dbh = new PDO("oci:dbname=local", "scott", "tiger");
$sth=$dbh->prepare($SQL1);
$sth->bindParam(":ENAME",$name,PDO_PARAM_STR,100);
$sth->execute();
$cnt=$sth->columnCount();
echo "This statement returns ",$cnt, " columns\n";
for($i=0;$i<$cnt;$i++) {
print_r($sth->getColumnMeta($i));
print("\n");
catch (PDOException $e) {
echo "Failed to obtain database handle " . $e->getMessage(),"<br>\n";
?>
Here is the output:
$ ./test_pdo.php
This statement returns 8 columns
PHP Warning: PDOStatement::getColumnMeta(): SQLSTATE[IM001]: Driver does not support this function: driver doesn't support meta data in /home/mgogala/tmp/test_pdo.php on line 13
PHP Warning: PDOStatement::getColumnMeta(): SQLSTATE[IM001]: Driver does not support this function: driver doesn't support meta data in /home/mgogala/tmp/test_pdo.php on line 13
PHP Warning: PDOStatement::getColumnMeta(): SQLSTATE[IM001]: Driver does not support this function: driver doesn't support meta data in /home/mgogala/tmp/test_pdo.php on line 13
The query executes correctly, because I am getting the correct number of columns. Unfortunately,
the driver tells me that it cannot describe the column, that is, return array containing name,
native data type, length, precision and PDO data type. That is ridiculous as all 3 other methods
(OCI8, PEAR DB and ADOdb) have no problems whatsoever with describing the column. OCI8, the most comprehensive one of those packages has the following functions to that end:
ocicolumnname -- Returns the name of a column
ocicolumnprecision -- Tell the precision of a column
ocicolumnscale -- Tell the scale of a column
ocicolumnsize -- Return result column size
ocicolumntype -- Returns the data type of a column
Using those functions, I would have no problem obtaining the desired information. PDO_OCI
can't do that. So far, it is very far away from being actually usable. Things might look better
when 5.1 is actually released, but so far it can't be used. Also, when an incorrect SQL is used
in the script above, an exception is not thrown.
I commend your efforts to promote it and I believe that Zend Core for Oracle is a great thing as
it simplifies the installation a great deal, but I will continue to use ADOdb for the foreseeable future.Hmmm, the script in my post is all squashed and ruined, despite my best efforts.
If you need original, please contact me at [email protected] There is also an intial version
of a DBA tool written in PHP5 on my web page, which is: http://www.mgogala.com -
How do I execute "Select count(*) from table " in OCI
Hi,
I am new to OCI and so this question may seem stupid. I would like to know how to execute the query "select count(*) from <table>" using OCI V8 functionality? Also after how do I get the result into a integer datatype? I have gone through most of the demo programs but is is of little help to me.
Thanks in advance...
Regards,
Shubhayan.Hi,
Here is sample code to give you some idea how to do it. If you want some more info let me know.
Pankaj
ub4 count;
// Prepare the statement.
char szQry = "SELECT count() FROM T1";
if(OCI_ERROR == OCIStmtPrepare(pStmthp, pErrhp, (unsigned char*)szQry, strlen(szQry), OCI_NTV_SYNTAX , OCI_DEFAULT) )
cout << "Error in OCIStmtPrepare" << endl;
exit(1);
// Bind the output parameter.
OCIDefine *pDefnpp;
if(OCI_ERROR == OCIDefineByPos ( pStmthp, &pDefnpp, pErrhp, 1,
&count, sizeof(ub4), SQLT_INT,
(dvoid *) 0, (ub2 *) 0, (ub2 *) 0,
OCI_DEFAULT) )
cout << "Error in OCIDefineByPos" << endl;
exit(1);
if(OCI_ERROR == OCIStmtExecute(pSvchp, pStmthp, pErrhp, 1, 0, NULL, NULL, OCI_DEFAULT) )
cout << "Error in OCIStmtExecute" << endl;
exit(1); -
Creating Rule file to pull data from OCI Interface
Hi.
I am new to OCI, I have worked on DSN method earlier to pull data from database.
Can someone give me steps of how to pull data from OCI interface.
My database is Oracle 11gR2 and I am using 11.1.2.2 Fusion version.
Regards
Mahesh BallaThe following post may help - Re: Essbase Rules Files and OCI
There have been a number of issues relating to data and using OCI, I am not sure whether they are all resolved in 11.1.2.2 so if you are using OCI make sure you validate the data once loaded into essbase.
Cheers
John
http://john-goodwin.blogspot.com/ -
"new PDO" inconsistent in connections across our servers
Using PDO oci, our application web pages connect to various Oracle databases. All database connections before used the following connect strings successfully:
$conn = new PDO("oci:dbname=//servername.domain*:1521*/db_service_name",$db_username,$db_password);
up until last Friday 5/18 when one particular server connection attempt would throw a "Fatal error" unless we modify the connection string as follows:
$conn = new PDO("oci:dbname=//servername.domain/db_service_name",$db_username,$db_password); // no port number
php version appears to be 5.3, database version is 10.2.0.5.0, all running on linux RHEL 5. Other connections using RHEL 4, but I believe that is moot in that the app server running php 5.3 with oci8.so to connect to the database server running oracle 10.2.0.5 was working, but on Monday 5/21, it was not working.
Fatal error when not working is:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[]: (null)' in /home/driskind/test_oci.php:7
Stack trace:
#0 /home/driskind/test_oci.php(7): PDO->__construct('oci:dbname=//ea...', 'user...', 'password')
#1 {main}
thrown in /home/driskind/test_oci.php on line 7
Note that from this same host, php can connect to older database servers utilizing the connection string with the port number, so I am suspecting a configuration on the database server side for the new database server where connection string using port number fails.
Please don't ask why application doesn't use other methods. They have adamantly stated they wish to continue to use thier application with php configured as is.Unless things have really changed with PDO I recommend not using it. Just use the OCI_ methods. For me the biggest problem is that PDO ( at my last reading ) does not support reference cursors which for me is just a non starter.
-
OCI c++ how to ... HELP HELP
Hi,
I am new with OCI so I need some help. I included all
header files I need and I specified -lclntsh but I am
getting an error message from my compiler/linker :
/oracle/8.0.5/lib/libclntsh.so: undefined reference to
'slpmprodstab'
collect2: ld resturned 1 exit status
My command line looks like this
g++ -o test test.o oconnection.o -lclntsh -L/oracle/8.0.5/lib -
L/oralce/8.0.5/rdbms/lib
I think I'm missing a bunch of things ...
Thanks
Eddy
nullHi,
for my work I stripped down the OCI demo makefiles from oracle.
this one compiles a program "ora1.c" to "ora1". note that this is
for c, not c++, but it might help:
----- File: Makefile -----------------------------------
INCLUDE=-I$(ORACLE_HOME)/rdbms/demo \
-I$(ORACLE_HOME)/rdbms/public \
-I$(ORACLE_HOME)/plsql/public \
-I$(ORACLE_HOME)/network/public
LDFLAGS=-L$(ORACLE_HOME)/lib -L$(ORACLE_HOME)/rdbms/lib
DEF_OPT=$(ORACLE_HOME)/rdbms/lib/defopt.o
SSCOREED=$(ORACLE_HOME)/lib/sscoreed.o
OCISHAREDLIBS=$(ORACLE_HOME)/lib/libclntsh.so \
$(ORACLE_HOME)/lib/nautab.o \
$(ORACLE_HOME)/lib/naeet.o \
$(ORACLE_HOME)/lib/naect.o \
-lclient -lvsn -lmm -lnetv2 -lnttcp \
-lvsn -lcommon -lgeneric -lepc -lcore4 \
-lnlsrtl3 -lnsl -lm -ldl -lnetv2 -lnttcp \
-lnetwork -lncr -lsql
ora1: ora1.o
$(CC) $(LDFLAGS) -o ora1 ora1.o $(DEF_OPT) $(SSCOREED) \
$(OCISHAREDLIBS)
ora1.o: ora1.c
$(CC) -Wall -O2 $(INCLUDE) -c ora1.c -o ora1.o
clean:
$(RM) -f ora1.o ora1
You also might have a look at
$ORACLE_HOME/rdbms/demo/demo_rdbms.mk
hope this gets you started
Peter
Eddy Hahn (guest) wrote:
: Hi,
: I am new with OCI so I need some help. I included all
: header files I need and I specified -lclntsh but I am
: getting an error message from my compiler/linker :
: /oracle/8.0.5/lib/libclntsh.so: undefined reference to
: 'slpmprodstab'
: collect2: ld resturned 1 exit status
: My command line looks like this
: g++ -o test test.o oconnection.o -lclntsh -L/oracle/8.0.5/lib -
: L/oralce/8.0.5/rdbms/lib
: I think I'm missing a bunch of things ...
: Thanks
: Eddy
null -
Wls1211_generic.jar & wls_121200.jar & OCI
DriverManager.getConnection("jdbc:oracle:oci:@", info); work prefect on weblogic installed from(wls1211_generic.jar)!
But when i try run it under weblogic installed from wls_121200.jar it throw "java.lang.UnsatisfiedLinkError: no ocijdbc11 in java.library.path"
System.getProperty("java.library.path");
wls_121200.jar
wls1211_generic.jar
D:\app\product\112~1.0\client_1\BINBIN;
D:\app\product\11.2.0\client_1\BIN;
when I start weblogic(wls_121200.jar) with "-Djava.library.path=D:\app\product\11.2.0\client_1\BIN;" it throw "java.lang.UnsatisfiedLinkError ocijdbc11.dll: Can't find dependent libraries"
How to resolve this problem?
P.S. I am sorry for my english.You can make your life much simpler and lose nothing if you were to use the JDBC driver in the 'thin' mode, not 'oci'.
The oci mode is not recommended for several reasons:
1 - There is a brittle one-to-one relationship between a given version of the JDBC driver jar, with a given version of
the Oracle OCI client libraries, so if you change the driver version (WLS versions have different driver versions),
then you would have to install the new/appropriate OCI libraries.
2 - Any bug in OCI native code can kill an entire JVM/weblogic server.
There is nothing nowadays that the driver operating in the thin mode cannot do, that it can do in the OCI mode,
and using it that way allows you to run or change among any multiple versions of the driver without concern,
as they run independently and are completely self-contained. -
I am creating Oracle 9i Spatial objects, which have two VARRAYs. I am new to OCI. What is the usual way of creating with varrays in OCI? I can get the object created with OCIObjectNew, and append elements one at a time with OCICollAppend, but I am a little unhapy with this - I expected to be able to allocate storage for a number of elements, then set them one at a time. I distrust the overhead and fragmentation of memory using an append for each element.
The OCI Guide provides no examples, and I can only find one example program writing a collection.
Is there a way of allocating multiple entries for the varray at once ?
Are there other examples of writing varrays or other collections?
Thanks,
David PeningtonNope. Once you create an array, and give it a size, you're stuck with it. Its the same in any language that I've used (C, Pascal, Java...)
If you need a larger array(ie add one more element in) you need to redeclare your array.
There is a helper method that you can use:
System.arrayCopy(...) will copy the values from one array to another for you.
public String[] addName(String[] names, String newName){
String[] newList = new String[names.length+1]);
for (int i=0; i<names.length; i++){
newList[i] = names;
newList[newList.length-1] = newName;
return newList;
// somewhere in another method...
public void testArray(){
String[] names = new String[0];
names = addName(names, "Bob");
names = addName(names, "Bill");
No its not wonderfully efficient, but thats how its done.
The availability of the Collections framework for dynamically sized lists means that not being able to do it with primitive arrays isn't so important. -
How to call store procedure from an oci program
Hello,
I work on Oracle 8.1.7 under AIX.
I must call from an OCI C++ program a store procedure that have an result set as param out.
I'm not sure how can I call the procedure/function. I want to execute this statement and fetch the results.:
" CALL Department.get_all (:1) " is this OK?
" Call department.GetAll() into :1 "
I have seen some example from an PL/SQL block but that's not ok for me.
what i have done:
i have created an package
create or replace package department as
type cursor_type is ref cursor;
procedure get_emp( i_deptno in number, rs out cursor_type );
procedure get_all( rs out cursor_type );
function GetAll return cursor_type;
end department;
create or replace package body department as
procedure get_emp ( i_deptno in number, rs out cursor_type )
as
begin
open rs for
select empno, ename
from emp
where deptno = i_deptno;
end;
procedure get_all ( rs out cursor_type )
as
begin
open rs for
select empno, ename
from emp;
end;
function GetAll return cursor_type
as
l_cursor cursor_type;
begin
open l_cursor for select ename, empno from emp;
return l_cursor;
end;
end;Hi,
I am new to OCI facing the same problem you have mentioned, If you have found out how to solve it , can you post the answer for the same.
Thanks
Mani -
Fetching whole table using OCI calls
I am new to OCI programming .I am writing an appliaction in C# to fetch data from ORACLE using OCI calls,Using that application i can able to fecth single row,
but i need to load/ fetch the entire table data from the database using the single fetch?
I have created a scrollable resultset by using the below give statement
and i can able to fetch single coloumn.
short paramSizee = 20;
IntPtr TestNo = GetPointer((int)paramSizee);
rc = OCI.OCIDefineByPos(hStatement, out HDefine, hError, 1, TestNo, paramSizee, OCI.DATATYPE.VARCHAR2, OCI.NullHandleRef, OCI.NullHandleRef, OCI.NullHandleRef, OCI.MODE.OCI_DEFAULT);
if (rc != 0)
Console.WriteLine(CheckError(hError));
throw new Exception("OCI Define Failed...");
rc = OCI.OCIStmtExecute(hServiceContext, hStatement, hError, iters, 0, OCI.NullHandleRef, OCI.NullHandleRef, OCI.MODE.OCI_STMT_SCROLLABLE_READONLY);
rc = OCI.OCIStmtFetch(hStatement, hError,50, OCI.FETCH.OCI_FETCH_NEXT, OCI.MODE.OCI_DEFAULT);
if (rc != 0)
Console.WriteLine(CheckError(hError));
throw new Exception("OCI Fetch Failed...");
Using above calls i can able to fetch arround 100 rows per fetch but my customer table has 16000 rows .
So it will be great if someone suggest proper way to fetch entire table data in single fetch.
Thanks,
RajFor fetching large number of rows in single Db roundtrip use the following
To get the bulk Data use the following.MAX_PREFETCH_ROWS is the integer value you want fetch in BULK
(void) OCIAttrSet((dvoid *)DBctx->stmthp, (ub4) OCI_HTYPE_STMT,
(dvoid *)&MAX_PREFETCH_ROWS,(ub4)sizeof(MAX_PREFETCH_ROWS),
(ub4) OCI_ATTR_PREFETCH_ROWS, DBctx->errhp); -
Usage of Varray in a Stored Procedure Executed through OCIStmtExecute
Hi,
I'm new to OCI Programming. My requirement is to pass an array to a Stored Procedure.
In Stored Procedure this input variable is of type VARRAY.
I'm following the approach given below.
OCITypeByName()
OCIObjectNew()
OCICollAppend()
OCIBindByPos()
OCIBindByObject()
OCIStmtExecute()
I encounter an error in OCITypeByName (this function call fails)
Can anyone provide me some sample codes
Also pls provide information if there is a better approach to be followed in this regard.
Thanks,
Alamelu
nullHi Alamelu,
Make sure you created the type correctly in the database using SQL DDL.
You can verify that from sqlplus
sqlplus username/password
describe typename;
Here is a code snippet :-
#define SCHEMA "TKP8ADT1"
OCITypeByName(envhpx, errhp, svchpx, (const text *) SCHEMA,
(ub4) strlen((char *)SCHEMA), (const text *) "ADDRESS_VALUE",
(ub4) strlen((char *)"ADDRESS_VALUE"), (CONST text *) 0,
(ub4) 0, OCI_DURATION_SESSION, OCI_TYPEGET_HEADER, &addr_tdo);
thanks,
Ravi -
Crash when using pdo_oci
Hi there,
First my problem is, that when I try to start a db connection over pdo_oci, php will crash.
More information later in the post.
My system:
Red Hat Enterprise Linux ES release 4 (Nahant Update 3)
Apache/2.2.6 (Unix)
PHP Version 5.2.5
Oracle Instant client 10.2.0
I've build PHP with following flags:
'./configure' '--with-apxs2=/CHBS/apps_local/apps/apache2/bin/apxs' '--with-mysql=/CHBS/apps_local/apps/mysql' '--prefix=/CHBS/apps_local/apps/php' '--with-config-file-path=/CHBS/apps_local/apps/php' '--enable-force-cgi-redirect' '--disable-cgi' '--with-zlib' '--with-gettext' '--with-gdbm' '--exec-prefix=/CHBS/apps_local/apps/php' '--with-zlib' '--with-oci8=instantclient,/u01/home/oracle/product/10.2.0/CL' PHP compiled without problems.
My env-vars:
ORACLE_HOME=/u01/home/oracle/product/10.2.0/CL
TNS_ADMIN=/u01/home/oracle/local
ORACLE_SID=orcl
LD_LIBRARY_PATH=/u01/home/oracle/product/10.2.0/CL/lib
NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
The PHP-File:
<?php
$pdo = new PDO( "oci:host=mydb;dbname=mydb", "myuser", "mypassword", array( PDO::ATTR_PERSISTENT => true ) );
echo "Connection done";
?>This file will work on gentoo.
php bash output:
bash-3.00# php -a test.php
Interactive mode enabled
Connection doneIf I try to call the file over the web, the page will not load. Get this message:
[code=SERVER_RESPONSE_CLOSE] The server closed the connection while reading the response. Contact your system administrator.There is no information logged in the apache error log.
Now I don't know where the problem can be.
Some last information:
php.ini
extension=pdo_oci.sophpinfo()
oci8:
Version 1.2.4
Revision $Revision: 1.269.2.16.2.38 $
Oracle Instant Client Version 10.2
Temporary Lob support enabled
Collections support enabled
PDO:
PDO drivers sqlite2, sqlite, oci
PDO Driver for OCI 8 and later enabled
other:
libxml2 Version 2.6.16
ZLib Support enabled
HOSTTYPE i386-linux
TNS_ADMIN /u01/home/oracle/local
C_INCLUDE_PATH /u01/home/oracle/product/10.2.0/CL/include
ORACLE_HOME /u01/home/oracle/product/10.2.0/CL
NLS_LANG AMERICAN_AMERICA.WE8ISO8859P1apache configuration:
./configure --prefix=/CHBS/apps_local/apps/apache2 --enable-so--enable-cgi--enable-info--enable-rewrite--enable-speling--enable-usertrack--enable-deflate --enable-ssl--enable-mime-magic --exec-prefix=/CHBS/apps_local/apps/apache2So that all information I have.
Thanks a lot for helpOk, that pdo is not the best I know. But my projects working with pdo well, only on the new server it will not run. I don't know a other way then pdo.
I debugged it with gdb:
#0 0x013730fa in gsluinit () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#1 0x01373920 in gsluizgcGetContext () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#2 0x01361171 in gslccx_Getgsluctx () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#3 0x013440c7 in ora_create_discov_hdl () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#4 0x0148a458 in nnflgetnlpactx () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#5 0x0148aab1 in nnflgcp () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#6 0x01485daf in nnflobc () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#7 0x014843a6 in nnfln2x () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#8 0x01482b76 in nnflboot () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#9 0x013a362c in nnfgrne () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#10 0x014ace6f in nlolgobj () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#11 0x013a1bc2 in nnfun2a () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#12 0x013a1834 in nnfsn2a () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#13 0x013e3b20 in niqname () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#14 0x0130e0a9 in kwfnran () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#15 0x012d6ca0 in kwfcinit () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#16 0x01137361 in kpuatch () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#17 0x012545bd in OCIServerAttach () from /server_files/apps/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
#18 0x00ad533f in pdo_oci_handle_factory (dbh=0x92ea1b8, driver_options=0xb7e938bc)
at /server_files/downloads/sources/php-5.2.5/ext/pdo_oci/oci_driver.c:574
#19 0x00ac8dff in zim_PDO_dbh_constructor (ht=4, return_value=0xb7e938f8, return_value_ptr=0x0, this_ptr=0xb7e95dac, return_value_used=0)
at /server_files/downloads/sources/php-5.2.5/ext/pdo/pdo_dbh.c:372
#20 0x00c8c9df in zend_do_fcall_common_helper_SPEC (execute_data=0xbff24c90) at /server_files/downloads/sources/php-5.2.5/Zend/zend_vm_execute.h:200
#21 0x00c8d3f5 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (execute_data=0xbff24c90) at /server_files/downloads/sources/php-5.2.5/Zend/zend_vm_execute.h:322
#22 0x00c8c5f4 in execute (op_array=0xb7e920f0) at /server_files/downloads/sources/php-5.2.5/Zend/zend_vm_execute.h:92
#23 0x00c6cd16 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /server_files/downloads/sources/php-5.2.5/Zend/zend.c:1134
#24 0x00c268ba in php_execute_script (primary_file=0xbff26f60) at /server_files/downloads/sources/php-5.2.5/main/main.c:2004
#25 0x00cd286f in php_handler (r=0x92e60d8) at /server_files/downloads/sources/php-5.2.5/sapi/apache2handler/sapi_apache2.c:631
#26 0x08071b02 in ap_run_handler (r=0x92e60d8) at config.c:157
#27 0x08071ecd in ap_invoke_handler (r=0x92e60d8) at config.c:372
#28 0x08086231 in ap_process_request (r=0x92e60d8) at http_request.c:258
#29 0x08083ec5 in ap_process_http_connection (c=0x92e2260) at http_core.c:184
#30 0x0807730a in ap_run_process_connection (c=0x92e2260) at connection.c:43
#31 0x08096b03 in child_main (child_num_arg=Variable "child_num_arg" is not available.
) at prefork.c:640
#32 0x08096ccc in make_child (s=0x2, slot=0) at prefork.c:680
#33 0x0809721f in ap_mpm_run (_pconf=0x91440a8, plog=0x91821a0, s=0x9148c80) at prefork.c:956
#34 0x08061fac in main (argc=2, argv=0xbff274c4) at main.c:730May someone have the same?
Maybe you are looking for
-
Mac mini cannot open cd because data could not be read or written -
Mac mini (Mac OSX 10.6.8) cannot open cd/files because data could not be read or written. Error code -36. What is way to correct this problem? Thanks so much.
-
Hello I'm working with Oracle Forms 6i and I need to check if a certain folder exists before I make an action, I think there's no way to do it with Oracle Forms only, so I tough doing it with vba. Is there some controller that allow me to use vba in
-
Inventory service does not start 610 failed login
L.S. Netware 6.5, SP6 ZEN 7.01SP1IR1 Sybase database Standalone server My inventory service does not start. I've looked around but did not yet find the solution. I did have an error I've read nothing about: logger screen: java:Class com.novell.....ZE
-
Please help: Problem sending fax to one recipient using Apple USB Modem
Hello, I'm using an Apple USB Modem to send an receive faxes on my PowerMac G5. This is working great to the most recipients, but not one with a Philips fax machine. The problem is, that everybody can send faxes to him - except of me I'm using a soft
-
Has anyone experienced a activity actual start date moving when updating progress
When updating an activity progress in a small schedule i notice that one of my activities which had already started on march 19th and was about 10% complete from a prior update jumped to March 23rd as start date. What is going on???