Oracle OCI8 Database Connection Problem #2 [Linux]

Hello folks,

Recently, I had another problem connecting to an Oracle 10g R2 database with the Oracle Call Interface. Well, this was not about the driver actually. Having passed 2 weeks from my first problem, this time I was deploying the servlet, Tomcat 6 and Oracle 10g R2 to a OpenSUSE 10.3 machine. It still was stopping at this line:

connection = DriverManager.getConnection(url, username, password);

However, the strange thing was that although I have a catch statement with SQLException in it, it didn’t seem to catch it, it got straight to the finally statement’s block of code. Luckily, I took into account some logging considerations while implementing and although it didn’t point me straight to the problem, the java.util.logger saved me a lot of time as to what got wrong. I, again, tried to connect using sqlplus. However the bash shell didn’t recognize the command. I immediately thought that the environmental variables may be wrongly set, though I was sure that I set them before. The point is, I set them using the oracle user. However, I was running my servlet and thusly the Tomcat application server using the root account. Thus, although The Oracle Database Home page was correctly running at http://localhost:8084/apex (8080 is allocated to Tomcat), I thought that the OCI may be using executables from the ORACLE_HOME and this may very well be the cause of my problems. Thus, I’ve set them again as the root user and the problem was solved. The important thing to notice is that you should set them in the .bashrc file, otherwise they seem to get lost when you open up a new bash shell. I also tried .profile and .bash_profile but they didn’t seem to work. Any idea why? I actually thought at first that these files were the right way to do it.

Not having too much experiences with Linux, I seem to have overlooked this environmental variable/users issue.(Well, still I presumably know more than the next guy at work)

Advertisements

1 Comment

  1. September 23, 2010 at 9:29 pm

    Did you check every services work or not? It indicates there is something wrong with your services.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: