System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to connect with database

 
Rahul Shukla
Occasional Visitor

Not able to connect with database

Hi Experts,

I just have written a sampleconn.pc file to connect with Oracle 10g database.

I am compiling it using command

$proc sampleconn.pc

$ cc -o sampleconn sampleconn.o
ld: Unsatisfied symbol "sqlcxt" in file sampleconn.o
1 errors.

I am getting the above error and not able to resolve this error from past three days. Please help me in resolving the issue.

I have tried ldd command

$ ldd -r sampleconn
libc.so.1 => /usr/lib/hpux32/libc.so.1
libdl.so.1 => /usr/lib/hpux32/libdl.so.1
symbol not found: sqlcxt (sampleconn)

PC file contents are below

#include
#include
#include
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR uid[30];
VARCHAR pwd[30];
EXEC SQL END DECLARE SECTION;

EXEC SQL INCLUDE SQLCA.H;

void main()
{

strcpy(uid.arr,"DUMMY");
uid.len =strlen(uid.arr);
strcpy(pwd.arr,"DUMMY");
pwd.len = strlen(pwd.arr);

EXEC SQL WHENEVER SQLERROR GOTO errexit;
EXEC SQL CONNECT :uid IDENTIFIED BY :pwd;

printf("Connected to Oracle\n");

EXEC SQL COMMIT WORK RELEASE;
return;

errexit:
printf("Connection failed");
return;


} /* end of main */

Please help me as soon as possible.
I am struck in urgent issue.


$ echo $LD_LIBRARY_PATH
/oraclewhwb/app/oracle/10g:/oraclewhwb/app/oracle/10g/precomp/lib:/oraclewhwb/app/oracle/10g/rdbms/public:/oraclewhwb/app/oracle/10g/lib:/oraclewhwb/app/oracle/10g/lib32:/opt/java1.5/jre/lib/IA64N/server/:/oraclewhwb/app/oracle/10g/lib/libocci10_296.so.10.1:/oraclewhwb/app/oracle/10g/lib/libordim10.soO

$ echo $PATH
/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bin:/opt/perl/bin:/opt/ipf/bin:/opt/gvsd/bin:/opt/nettladm/bin:/opt/fcms/bin:/opt/wbem/bin:/opt/wbem/sbin:/opt/sas/bin:/opt/graphics/common/bin:/opt/atok/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/sec_mgmt/bastille/bin:/opt/caliper/bin:/opt/drd/bin:/opt/dsau/bin:/opt/dsau/sbin:/opt/resmon/bin:/opt/firefox:/opt/gnome/bin:/opt/ignite/bin:/usr/contrib/kwdb/bin:/opt/mozilla:/opt/perl_32/bin:/opt/perl_64/bin:/opt/prm/bin:/opt/sfm/bin:/opt/swm/bin:/opt/sec_mgmt/spc/bin:/opt/ssh/bin:/opt/sentinel/bin:/opt/swa/bin:/opt/hpsmh/bin:/opt/thunderbird:/opt/langtools/bin:/opt/gwlm/bin:/opt/hpvm/bin:/opt/hp-gcc/bin:/oraclewhwb/app/oracle/10g/bin:/oraclewhwb/app/oracle/10g/precomp/public:/oraclewhwb/app/oracle/10g/precomp/lib:/oraclewhwb/app/oracle/10g/rdbms/public:/oraclewhwb/app/oracle/10g/lib


Thanks
Rahul Shukla
3 REPLIES

Re: Not able to connect with database

$ cc sampleconn.o
ld: Unsatisfied symbol "sqlcxt"

You need to link your program with some oracle libs.
Rahul Shukla
Occasional Visitor

Re: Not able to connect with database

Hi Dennis,

Thanks for reply. I have include $ORACLE_HOME/lib path in my $LD_LIBRARY_PATH. I also have tried nm $ORACLE_HOME/lib/* | grep sqlcxt. It gave me

nm: /oraclewhwb/app/oracle/10g/lib/libclntst10.a: cannot open
[68] | 0| 0|FUNC |GLOB |0| UNDEF|sqlcxt
[35] | 0| 0|FUNC |GLOB |0| UNDEF|sqlcxt
[68] | 0| 0|FUNC |GLOB |0| UNDEF|sqlcxt
[18] | 0| 0|FUNC |GLOB |0| UNDEF|sqlcxt

So I include this static library at the time of linking also I am giving required header files with -I flag at the time of linking.
Can you please help me which library file I am missing and where to include it's path.

Looking for your help -

Re: Not able to connect with database

>nm $ORACLE_HOME/lib/*

If you are going to scan multiple libs, you should use:
nm -pxAN $ORACLE_HOME/lib/*

[68] | 0| 0|FUNC |GLOB |0| UNDEF|sqlcxt

These are all uses but no definitions of sqlcxt.

>Can you please help me which library file I am missing and where to include it's path.

I would assume your proC or oracle documentation would tell you that.
You need to add -l XX on your link line.