OCI on Linux
Hi,
I am trying to use the OCI libraries to connect to Oracle (and then do something worthwhile). This is what I did so far:
1. Built a development box with Celeron 400 Mhz, redhat 6.2.
2. Created a directory structure for oracle similar to an existing box that had oracle server on it.
3. Copied all the header files from the directories ORACLE_HOME/rdbms/demo, ORACLE_HOME/rdbms/public and ORACLE_HOME/network/public
3. Copied the libraries "libclnsh.so" and "libwtc8.so" to ORACLE_HOME/lib
4. Wrote a test program, within which I have the following:
<snip>
OCILogon(envhp, errhp, &svchp,
username, (ub4)strlen((char*)username),
password, (ub4)strlen((char*)password),
server, (ub4)strlen((char*)server));
</snip>
5. Compiled and ran successfully. But couldn't connect. For the above "OCILogon", this is what I get:
main.c(74): Error - OCI_ERROR:
Error while trying to retrieve text for error ORA-12154
6. Copied the file "tnsnames.ora" to the directory ORACLE_HOME/network/admin (from the db server). This is what it contains:
#begin
SEIPL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.0.151)(PORT = 1521))
(CONNECT_DATA =
(SID = seipl)
#end
7. Recompiled and ran and got the same error again.
8. Added "ORACLE_HOME" in my ".bash_profile" and re-ran and got the same error.
I did NOT install oracle client on the development box, since I read (a long time ago), that all I need is these libraries.
Any ideas, whats missing? Anything I am doing wrong?
TIA,
manav.
I'm not sure what you are doing wrong, but as far as I remember, you should be able install the OCI libraries without the client and the rest of the software that comes with it.
Similar Messages
-
Has anyone used multithreaded OCI under linux? If so could you please tell me how you got this to work. What libraries and settings etc. as this does not seem to be working for me.
AaronWhat doesn't work (compile, link, etc)? What errors do you see?
-
I'm trying to get OCI for linux, basically so I can get this program that I'm porting to compile. Couldn't find it explicitly anywhere, so I've downloaded the entire oracle8161SE_tar.gz, assuming it's in there somewhere. Apon trying to install it, I've realized it needs X for the installer. Now it appears I'll have to install X, to install Oracle, to get a couple headers and some libs.....is there an easier way to do this?
Thanksrobert krueger (guest) wrote:
: Hi,
: I read that some people are using the JDBC OCI driver with
Oracle
: 8 on linux. I can only find the OCI Drivers for NT and Solaris
on
: the download pages. Can anyone give me a hint where to download
: the native Linux driver?
: btw. I am running the early adopters release on linux
: thanks,
: robert
JDBC (thin & OCI) drivers were not shipped with Early Adopter
Release of Oracle8 on Linux. They are shipped with Oracle8
Production Release.
Get Technical!
http://technet.oracle.com
null -
OCI on Linux 6.1 with Oracle 8.1.5.2
When I compile, link and run OCI programs they run fine under Linux 6.1. However
when I call library functions in shared library files (.so) which do identical connection to server the call to OCIServerAttach just hangs around forever. Does anyone have any insights into this?I had a problem with the old calls olog etc..
the problem was that the lda is too small
for shared libraries..
so i have changed the lda to a size of 512
and now the calls work fine...
perhabs this is a help for you...
Oliver -
JDBC OCI on Linux crashes, pls help
Hi!
I'm trying to use jdk 1.2.2, and jdbc2 of 8.1.6(classes12_01.zip), on linux Oracle8i 8.1.5, and at some moment the app crashes with a SIGSEGV, after making several sqlqueries:
SIGSEGV 11* segmentation violation
si_signo [11]: SIGSEGV 11* segmentation violation
si_errno [0]: Success
si_code [0]: SI_USER [pid: 0, uid: 0]
stackpointer=0x44bbcff4
Full thread dump Classic VM (1.2.2-L, green threads):
"CaducatorThread" (TID:0x40eb5ab8, sys_thread_t:0x89af9e8, state:R) prio=1
at oracle.jdbc.oci8.OCIDBAccess.open_statement(Native Method)
at oracle.jdbc.oci8.OCIDBAccess.open(OCIDBAccess.java:458)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:288)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:307)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:194)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:177)
at oracle.jdbc.driver.OracleConnection.prepareStatement(OracleConnection.java:339)
at server.persistence.jdbc.JdbcProcessInstancePersMgr.getInstancesToDispose(JdbcProcessInstancePersMgr.java:1111)
I tried with the examples on jdbc/OCI and they worked, but my app, that is multithreaded, crashes.
Pls I don't know where to look anymore, I'm desperate.
Million Thanks in advance.
MarianoTry placing the jar file in the
{cfmx-root}/runtime/servers/lib (create if not already there)
directory if you have the server install or the
{jrun-root}/servers/lib directory if you have the multiserver or
j2ee install on JRun. Restart the Coldfusion applicatioin server.
Ted Zimmerman -
SIGSEGV in multithreaded app with OCI( on Linux
I have got a SIGSEGV in OCI9. Application is multithreaded.
OS Linux. Distribution SLES8. Libc version 2.2.5.
Oracle 9.2.0.5
Application is heavy multithreaded. SIGSEGV occures very rarely. But always in the same place.
Connect code:
static void oracle_init() {
ILock l(m_env);
if (counter++ <= 0)
(void)OCIInitialize(OCI_DEFAULT, 0, NULL, NULL, NULL);
ctor {
oracle_init();
(void)OCIEnvInit(&env, OCI_DEFAULT, 0, NULL);
(void)OCIHandleAlloc(env, (void **)&err, OCI_HTYPE_ERROR, 0, NULL);
connect {
checkerr(err, OCILogon(env, err, &ctx, (text *)const_cast<char *>(user.c_str()), user.len(), (text *)const_cast<char *>(password.c_str()), pass
word.len(), (text *)const_cast<char *>(db.c_str()), db.len()));
/u/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(nlolgobj+0x50f) [0x4044a22d]
/u/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(nnfun2a+0x243) [0x403bc7e3]
/u/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(nnfsn2a+0x66) [0x403bc310]
/u/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(niqname+0x18a) [0x40365a1a]
/u/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(kwfnran+0x11f) [0x402d5df7]
/u/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(kwfcinit+0x177) [0x402a9155]
/u/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(kpuatch+0x834) [0x4014f7d2]
/u/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(kpulon+0x1bc) [0x4015009e]
/u/app/oracle/product/9.2.0/lib/libclntsh.so.9.0(OCILogon+0xd1) [0x401e2167]
Any ideas? Maybe I should initialise OCI with other flags?OCIInitialize should be called with mode OCI_THREADED instead of OCI_DEFAULT.
-
Which lib must be link to when using OCI in linux?
i wanna compile the oracle demo ---- cdemo81.c
but i get the link error message:
[root@linux demo]# gcc cdemo81.c
/tmp/ccVcKaHr.o: In function `main':
/tmp/ccVcKaHr.o(.text+0x91): undefined reference to `OCIInitialize'
/tmp/ccVcKaHr.o(.text+0xa4): undefined reference to `OCIEnvInit'
/tmp/ccVcKaHr.o(.text+0xbd): undefined reference to `OCIHandleAlloc'
/tmp/ccVcKaHr.o(.text+0xd8): undefined reference to `OCIHandleAlloc'
/tmp/ccVcKaHr.o(.text+0xf3): undefined reference to `OCIHandleAlloc'
/tmp/ccVcKaHr.o(.text+0x11f): undefined reference to `OCIServerAttach'
/tmp/ccVcKaHr.o(.text+0x141): undefined reference to `OCIAttrSet'
/tmp/ccVcKaHr.o(.text+0x15c): undefined reference to `OCIHandleAlloc'
/tmp/ccVcKaHr.o(.text+0x18c): undefined reference to `OCIAttrSet'
/tmp/ccVcKaHr.o(.text+0x1bc): undefined reference to `OCIAttrSet'
/tmp/ccVcKaHr.o(.text+0x1dc): undefined reference to `OCISessionBegin'
/tmp/ccVcKaHr.o(.text+0x20f): undefined reference to `OCIAttrSet'
/tmp/ccVcKaHr.o(.text+0x22a): undefined reference to `OCIHandleAlloc'
/tmp/ccVcKaHr.o(.text+0x256): undefined reference to `OCIHandleAlloc'
/tmp/ccVcKaHr.o(.text+0x297): undefined reference to `OCIStmtPrepare'
which library must be linked to ?I believe you need to compile it with the makefile. Type
make -f demo_makefile.mk cdemo81.cfrom the directory and it should work.
This worked for everyone else but in my computer I then get
libcltsh.so.8.0 not found (although the driver is there)
Anyone hope it works for you -
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,mjHi,
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. -
Hi,
I'm working with OCI in a multithreaded program, not oci, just posix threads.
Besides this, i need to set up a signal handler for SIGPIPE, and y noticed after implemented OCI calls that OCI is somehow bloking or reinstalling a handler not only for SIGPIPE, but for SIGINT too... I cant terminate my app from the console with crlt + C now, for example.
Does anyone knows or experienced with these kind of problems using OCI in linux?
Thanks a lot if u can help me.! .The functions you are looking for are osnsui() and osncui(). These functions register your own signal handler with Oracle.
The only documentation I have been able to find is in the Administrator's Reference for UNIX Systems, chapter 4, "Using Oracle Precompilers and the Oracle Call Interface" sub-heading "Using Signal Handlers"
HTH,
Robert Fayle -
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 Driver for oracle 8.1.5 under Linux OS?
Hello *,
Can somebody help me with a JDBC (level 2/OCI) Driver for Linux
(Suse7.1) running a 1.3 JavaVM from Sun?
Many thanx in advanceThe Oracle ODBC driver is a Windows-only product. It won't install on a UNIX machine.
Justin -
Steps to Connect remote Oracle Server using OCi C in Linux
Hi !
I am trying to connect oracle server through my application using OCI C in linux, it works fine in my oracle server machine.
I want to connect oracle server through my C application from Oracle Client Machine
can anyone help me in this issue ?
regards
Balaji.CSounds like you did not specify your database name. Or you database name is hard-coded.
Can you show us the code?
Is your TNSNAMES.ORA set up correctly?
Also, you did not specify any error messages or anything. Are you checking the result codes after any functions? -
Problem with OCI call and how to install and use 'DEBUG_EXTPROC' on Linux
Hi,
Can any one let me know how I can install and use this debug_extproc package. I have installed oracle XE server on Linux machine(32-bit).
When I use : DEBUG_EXTPROC.STARTUP_EXTPROC_AGENT' ... i get an error saying that : it is not declared.
I tried looking in all the directories but did not find the dbgextp.sql(which is required in order to install that package).And tried searching on google but could not get any relevant information.
Also I am newbie to OCI call interface and also to C programming too: I have coded a external procedure or custom user aggregate in C. But since I was using C++ : 'set' STL. I have compiled my program using g++ instead of gcc and I have correspondingly modified the make file in public/demo directory.
So, is it fine to do it that way: using OCI (instead of OCCI(C++)) but again compiling the pgm as a regular C++ using g++ instead of gcc.(But rest of the pgm including printf statements : everything is in C).
Also I have created the library from my : custagg.so library:
SQL> create or replace library custagg is '$ORACLE_HOME/lib/custagg.so'
But my aggregate function implemented as external C function using OCI is either not recognised or else : if recognized then there is some error because of which i am getting the following errors : ORA-06522
SQL> select MinDistance(TT) from egg1;
select MinDistance(TT) from egg1
ERROR at line 1:
ORA-06520: PL/SQL: Error loading external library
ORA-06522: /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/custagg.so:
cannot dynamically load executable
Please kindly answers my queries and trying to resolve this for almost 4 days now and could not find any clue on how to get this done.
Thanks,
-NN#/bin/make
# Make file for OCI,OCCI and ODBC demos
# Usage :
# For compiling & linking the cdemo81.c file
# make -f demo_xe.mk buildoci CDEMOEXE=cdemo81 CDEMOOBJS=cdemo81.o
.SUFFIXES: .o .c .cpp
ICINCHOME=$(ORACLE_HOME)/rdbms/public/
ICLIBHOME=$(ORACLE_HOME)/lib
ICLIBPATH=-L$(ICLIBHOME)
THREADLIBS=-lthread
CCLIB=$(ICLIBPATH) -lclntsh $(THREADLIBS)
OCCILIB=$(ICLIBPATH) -locci -lclntsh $(THREADLIBS)
CCINCLUDES = -I$(ICINCHOME)
CCFLAGS=$(CCINCLUDES) -D_REENTRANT -g -xs
LDFLAGS=
SO_EXT=.so
EXTLDFLAGS=$(LDFLAGS) -shared
REMOVE=rm -rf
MKLINK=ln
MAKE=make
MAKEFILE=demo_xe.mk
CDEMOEXE=custagg.so
CDEMOOBJS=custagg.o
OCCIDEMO=occidml
OCCIOBJDEMO=occiobj
OTT=$(ORACLE_HOME)/bin/ott
OCCIOTTUSR=hr
OCCIOTTPWD=hr
ODBCDEMOEXE=odbcdemo
ODBCDEMOOBJS=odbcdemo.o
AQDEMOEXE=ociaqdemo00
AQDEMOOBJS=ociaqdemo00.o
EXTDEMO=extdemo2.so
CC=/usr/bin/g++
echo "LIBCLNT value is :" $(LIBCLNT)
echo "CC value is :" $(CC)
.c.o:
g++ -c -I$(ICINCHOME) $(CCFLAGS) $<
all: clean buildoci
echo "LIBCLNT value is :" $(LIBCLNT)
buildoci: $(LIBCLNT) $(CDEMOOBJS)
g++ -o $(CDEMOEXE) $(LDFLAGS) $(CDEMOOBJS) $(CCLIB)
echo "CC value is :" $(CC)
echo "LIBCLNT value is :" $(LIBCLNT)
clean:
$(REMOVE) $(CDEMOOBJS) $(CDEMOEXE)
# This port-specific file is currently empty on Solaris. Product
# lines may use this file to override compiler definitions and
# flags used in occi.mk.
# Linux compiler definitions
CC=/usr/bin/gcc
cc=/usr/bin/gcc
CCFLAGS=$(CCINCLUDES) -DLINUX -D_GNU_SOURCE -D_REENTRANT -g
LDFLAGS=-g
# This macro CCINCLUDES has to be redefined on Linux because of
# the existence of the 'new' directory in t_work. The name new
# clashes with a system header file.
CCINCLUDES = -idirafter .
THREADLIBS=-lpthread
ifdef BUILD_CCC296
CC=/usr/bin/g++296
endif
And I am executing the make file using the command :
make -f demo12.mk buildoci CDEMOEXE=custagg.so CDEMOOBJS=custagg.o
I am not getting any error while running this make file.
Can you please tell me whether PLSQL/Oracle is able to locate the file or not. Incase, if it is locating the file but due to some error in the custagg.so it is throwing that error. If this is the case, is there any way that i can debug the C program .....how can i install the debug_extproc package.. I am really new to C & OCI ... if the custagg.so is being located then there might be some problem with the way I am dynamically allocating memory to some variables.
Please kindly reply to this Post/response.
Please let me know if you also want to see my program code.
Thanks & Regards,
-NN -
Tomcat on Linux with10g using OCI Client UnsatisfiedLinkError: no ocijdbc10
I'm having some issues configuring Tomcat with a 10g JDBC driver under Linux using the OCI thick client. When I attempt to get a database connection I get the following:
java.lang.UnsatisfiedLinkError: no ocijdbc10 in java.library.path
java.lang.ClassLoader.loadLibrary(Unknown Source)
java.lang.Runtime.loadLibrary0(Unknown Source)
java.lang.System.loadLibrary(Unknown Source)
oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java:2854)
oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:221)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:343)
oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:135)
oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:78)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:545)
org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:107)
org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:446)
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:512)
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:543)
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:564)
org.springframework.jdbc.object.SqlQuery.execute(SqlQuery.java:114)
org.springframework.jdbc.object.SqlQuery.execute(SqlQuery.java:201)
Now I've seen other instances of the above and they basically come down to making sure that the ojdbc14.jar file is in my classpath, and I thought I had that covered.
Here's everything I've done:
added ojdbc14.jar to $TOMCAT_HOME/common/endorsed
added ojdbc14.jar to $TOMCAT_HOME/common/lib
verified that ORACLE_HOME is defined: /app/oracle/product/10.1.0/client_1
verified that LD_LIBRARY_PATH is defined: /app/oracle/product/10.1.0/client_1/lib
added the following to the java commandline for Tomcat:
-Djava.library.path="$ORACLE_HOME"
the above -Djava.library.path didn't work so made the following change (which still didn't work)
-Djava.library.path="$ORACLE_HOME"/lib
my PATH variable includes both $ORACLE_HOME and $ORACLE_HOME/lib
echo $PATH:
/app/oracle/product/10.1.0/client_1:/app/oracle/product/10.1.0/client_1/lib
I have no idea what else I am missing or if my Oracle client installation is just hosed.
Any assistance would be appreciated.Use the thin driver.
no ocijdbc10 in java.library.path -
OCI demos-not able to compile on red hat Linux
Can anyone narrate how can I get the OCI routines (demo) working.
I feel that they are failing to run. what are the check points needed
that I should verify that an OCI program executes.
Does this needs any special settings or running any script files
before hand?.
I am running on Red hat 6.1 and Oracle 8.1.6 based on Linux.
when I detected the installations, following program folders are
missing
1. plsql/public
2. lib/libextp.a
I used one of the porgrams in the sample oci13.c and changed the user
account and password. I then compiled as follows
gcc -I(include files) -c oci13new.c
But after this it gave me successfully the object file. But I could not
able to link this to produce any a.out file!.
Can anyone suggest how can I do this?
NatStep 1) is needed, you cannot got directly from 8.1.5 to 10g.
When you are on level 8.1.7.4 (Step 2)) there are alternatives to export/import, for example DBUA. But first, you are right, you have to build up a 8.1.7.4 database on Linux, because this release does not allow other methods of transportation across different platforms. Or you import directly into a new built database on Linux.
For database upgrade see
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14238/preup.htm#sthref52
Step 3) is described step-by-step here:
http://www.oracle.com/technology/pub/articles/chan_sing2rac_install.html
Maybe you are looking for
-
Things to know before (and after) building a Mega 865
As I am seeing a lot of the same questions regarding the Mega 865 I created this document, 29-Oct-2004 Added Northwood benefits 29-Oct-2004 Emphasized NOT to use live update for bios update Processors in general Start with the processor, I would say
-
The actual error message is below: The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. This problem can sometimes be caused by disabling or refusing t
-
Why can't I enable disk use on my Ipod touch?
I wish to use my ipod touch as an external hard-drive. I have watched videos on how to go about it and they show that there is a greyed out check box that must be checked. This check box does not exist for me. Why not? and is it possible to enable di
-
Can't get external speakers to work ...
I want to use my old Altec Lansing ACS340 speakers with my new iBook, if possible, but when I plug them into the audio out, nothing happens. I know the sound is on (the iBook speakers work, and if I plug in headphones, they work), and I know the spea
-
Acrobat 9 standard para Windows XP
Mi programa ACROBAT 9 STANDARD para Windows XP da errores y no funciona. No me permite desisntalarlo. ¿Que tengo que hacer?