Skip to Main Content
  • Questions
  • Error while trying to retrieve text for error ORA-01804 12c occi c++ application on ubuntu

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Sisay .

Asked: August 19, 2016 - 8:36 am UTC

Last updated: November 09, 2020 - 3:44 am UTC

Version: 12c

Viewed 50K+ times! This question is

You Asked

Hello every one please help me after installing oracle 12c in ubuntu 16.04. I am try to check by simple c++ occi connection code,but from my code at create environment :- env = Environment::createEnvironment(Environment::DEFAULT); display error like:-
terminate called after throwing an instance of 'oracle::occi::SQLException'
what(): Error while trying to retrieve text for error ORA-01804

My sample c++ code is cat dbconnec.cpp
#include <occi.h>
#include <sstream>
#include <iostream>
#include <sstream>
#include <string>

using namespace oracle::occi;
using namespace std;
Environment *env;
Connection *con;
void create_connection(){
string user = "dbuser";
string passwd = "password";
string db = "localhost:1521/sid";
Statement *st = NULL;
ResultSet *rs2 = NULL;
env = Environment::createEnvironment(Environment::DEFAULT);;
try
{
con = env->createConnection(user, passwd, db);

}
catch (SQLException& ex)
{
cout << ex.getMessage();
}
}
int main(){
create_connection();
}
and my make file is:- cat makefile
test: dbconnec.o
g++ -o test dbconnec.o -I/opt/oracle/instantclient_12_1/sdk/include/ \
-L$(ORACLE_HOME) -locci -lclntsh
%.o: %.cpp
g++ -c -o $@ $< $ -I/opt/oracle/instantclient_12_1/sdk/include/
clean:
rm -f *.o test

please help this is consume more my time it is almost kill 5 days.Thanks in advance

and Connor said...

ORA-01804 is an error trying to lookup timezone information. But it normally indicates some sort of environmental issue, that is, it just so happens that the timezone stuff was the first thing to be looked for (and it failed).

Common causes:

LD_LIBRARY_PATH is not correctly set.
ORACLE_HOME is not correctly set.
NLS_LANG is not correctly set.

Check those and see how you go.

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Ivan, July 08, 2019 - 3:56 pm UTC

2 hosts with Red Hat Enterprise Linux Server release 7.5 (Maipo)

Downloaded instantclient-basic-linux.x64-12.2.0.1.0.zip
extracted.
Nothing else from/for Oracle is installed.
Installing Python cx_Oracle package.
.profile
export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2

trying to connect with Python. One host works well, another one gives:
cx_Oracle.DatabaseError: Error while trying to retrieve text for error ORA-01804
the user is owner of everything installed.
If extra files are needed they have to be a part of the client.

Connor McDonald
July 25, 2019 - 2:45 am UTC

I spoke the cx_oracle PM about this.

1804 probably means a timezone setting issue. He recommended to use the 19c client, but in particular, do the installation via RPM ( http://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/index.html ) because it takes cares of any setup etc.

In terms of why it works on one but not the other, check settings for TZ and ORA_SDTZ and of course file permissions to make sure they can actually read the Instant Client files.

Since you installed into /opt/oracle it would be better using ldconfig (as mentioned in Instant Client install instructions) instead of setting LD_LIBRARY_PATH

And of course, make sure you've done everything as listed in the cx_Oracle installation instructions

ORA-01804 - set ORACLE_HOME for instant_client

Konstantin Kivi, November 07, 2020 - 12:07 pm UTC

I have bumped into a similar issue with our own application.
I have used instant_client v12 and the instructions said that ORACLE_HOME should not set and if it is set it doesn't affect oracle_instant functioning. And indeed, sqlplus works without setting ORACLE_HOME, only with ORACLE_INSTANT. However, an OCI application failed to connect to the database with the error -
' Error while trying to retrieve text for error ORA-01804.'

Setting ORACLE_HOME=$ORACLE_INSTNT resolved the issue.

I believe that this should be addressed in the documentation.



Connor McDonald
November 09, 2020 - 3:44 am UTC

Thanks for the input!

More to Explore

Administration

Need more information on Administration? Check out the Administrators guide for the Oracle Database