Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » JDBC problem
JDBC problem [message #41070] Tue, 20 May 2003 22:14 Go to next message
Sridhar is currently offline Sridhar
Messages: 12
Registered: July 2009
Junior Member
I have a simple java program that gets a JDBC Connection. If I run this
program on a command line it runs fine. However if it is run from the
Eclipse debugger, I get runtime exception. I am wondering how to fix this
problem.

Thanks in advance.

Sridhar

Here is the code fragment I am using:
try {
String sDriver = "oracle.jdbc.driver.OracleDriver";
String sURL = "jdbc:oracle:oci8:@myDb";
String sUsername = "myacct";
String sPassword = "myPwd";

Class.forName( sDriver ).newInstance();
Connection conn = DriverManager.getConnection ( sURL,
sUsername,
sPassword);
}
catch(Exception ex) {ex.printStackTrace();}

Here is the exception I am getting:

ld.so.1: oracleleap: fatal: libskgxp8.so: open failed: No such file or
directory
java.sql.SQLException: ORA-12547: TNS:lost contact

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java: 168)
at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:15 97)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:354)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:246)
at
oracle.jdbc.driver.OracleDriver.getConnectionInstance(Oracle Driver.java:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:26 0)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
Re: JDBC problem [message #42319 is a reply to message #41070] Wed, 21 May 2003 14:04 Go to previous messageGo to next message
Haris Peco is currently offline Haris Peco
Messages: 1072
Registered: July 2009
Senior Member
Hi,
You haven't $ORACLE_HOME/lib in LD_LIBRARY_PATH or /etc/ld.so.conf, probably
I think that this work like oracle user on command line and then installer
set LD_LIBRARY_PATH for you

regards
Haris Peco

Sridhar wrote:

> I have a simple java program that gets a JDBC Connection. If I run this
> program on a command line it runs fine. However if it is run from the
> Eclipse debugger, I get runtime exception. I am wondering how to fix this
> problem.
>
> Thanks in advance.
>
> Sridhar
>
> Here is the code fragment I am using:
> try {
> String sDriver = "oracle.jdbc.driver.OracleDriver";
> String sURL = "jdbc:oracle:oci8:@myDb";
> String sUsername = "myacct";
> String sPassword = "myPwd";
>
> Class.forName( sDriver ).newInstance();
> Connection conn = DriverManager.getConnection ( sURL,
> sUsername,
> sPassword);
> }
> catch(Exception ex) {ex.printStackTrace();}
>
> Here is the exception I am getting:
>
> ld.so.1: oracleleap: fatal: libskgxp8.so: open failed: No such file or
> directory
> java.sql.SQLException: ORA-12547: TNS:lost contact
>
> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java: 168)
> at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:15 97)
> at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:354)
> at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:246)
> at
>
oracle.jdbc.driver.OracleDriver.getConnectionInstance(Oracle Driver.java:365)
> at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:26 0)
> at java.sql.DriverManager.getConnection(DriverManager.java:517)
> at java.sql.DriverManager.getConnection(DriverManager.java:177)
Re: JDBC problem [message #42518 is a reply to message #42319] Wed, 21 May 2003 13:23 Go to previous messageGo to next message
Sridhar is currently offline Sridhar
Messages: 12
Registered: July 2009
Junior Member
Hi,

Many Thanks for your response.

I checked the \"java.library.path\" variable and it does include
$ORACLE_HOME/lib. However I noticed that the sequence of entries is not
the same as those in the environment of the shell that launched the
Eclipse IDE. In otherwords, Eclipse seems to be constructing its own
LD_LIBRARY_PATH (based on the environment variable). I tried to set
-Djava.library.path to my LD_LIBRARY_PATH but that did not help. I am
wondering if there is any way we can specify the environment parameters in
a config file.

Thanks

Sridhar

snpe wrote:

> Hi,
> You haven\'t $ORACLE_HOME/lib in LD_LIBRARY_PATH or /etc/ld.so.conf, probably
> I think that this work like oracle user on command line and then installer
> set LD_LIBRARY_PATH for you

> regards
> Haris Peco

> Sridhar wrote:

> > I have a simple java program that gets a JDBC Connection. If I run this
> > program on a command line it runs fine. However if it is run from the
> > Eclipse debugger, I get runtime exception. I am wondering how to fix this
> > problem.
> >
> > Thanks in advance.
> >
> > Sridhar
> >
> > Here is the code fragment I am using:
> > try {
> > String sDriver = \"oracle.jdbc.driver.OracleDriver\";
> > String sURL = \"jdbc:oracle:oci8:@myDb\";
> > String sUsername = \"myacct\";
> > String sPassword = \"myPwd\";
> >
> > Class.forName( sDriver ).newInstance();
> > Connection conn = DriverManager.getConnection ( sURL,
> > sUsername,
> > sPassword);
> > }
> > catch(Exception ex) {ex.printStackTrace();}
> >
> > Here is the exception I am getting:
> >
> > ld.so.1: oracleleap: fatal: libskgxp8.so: open failed: No such file or
> > directory
> > java.sql.SQLException: ORA-12547: TNS:lost contact
> >
> > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java: 168)
> > at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:15 97)
> > at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:354)
> > at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:246)
> > at
> >
> oracle.jdbc.driver.OracleDriver.getConnectionInstance(Oracle Driver.java:365)
> > at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:26 0)
> > at java.sql.DriverManager.getConnection(DriverManager.java:517)
> > at java.sql.DriverManager.getConnection(DriverManager.java:177)
Re: JDBC problem [message #43129 is a reply to message #42518] Wed, 21 May 2003 14:16 Go to previous messageGo to next message
Eclipse User
Originally posted by: stelian.iancu.gmx.net

Sridhar wrote:

> Hi,
>
> Many Thanks for your response.
>
> I checked the \"java.library.path\" variable and it does include
> $ORACLE_HOME/lib. However I noticed that the sequence of entries is not
> the same as those in the environment of the shell that launched the
> Eclipse IDE. In otherwords, Eclipse seems to be constructing its own
> LD_LIBRARY_PATH (based on the environment variable). I tried to set
> -Djava.library.path to my LD_LIBRARY_PATH but that did not help. I am
> wondering if there is any way we can specify the environment parameters in
> a config file.
>

Try instead -Djava.library.path=$ORACLE_HOME/lib and see if it works.

--
Stelian Iancu
Linux registered user 287835

Be different. Think.
Re: JDBC problem [message #43750 is a reply to message #42518] Thu, 22 May 2003 10:56 Go to previous messageGo to next message
Haris Peco is currently offline Haris Peco
Messages: 1072
Registered: July 2009
Senior Member
Hi,
You set LD_LIBRARY_PATH in .profile (or .bash_profile) like oracle user
btw.
export LD_LIBRARY_PATH=$OARCLE_HOME/lib
Call eclipse after this
You can thin driver,too - then You needn't oracle lib

regards
Harsi Peco
Sridhar wrote:

> Hi,
>
> Many Thanks for your response.
>
> I checked the \"java.library.path\" variable and it does include
> $ORACLE_HOME/lib. However I noticed that the sequence of entries is not
> the same as those in the environment of the shell that launched the
> Eclipse IDE. In otherwords, Eclipse seems to be constructing its own
> LD_LIBRARY_PATH (based on the environment variable). I tried to set
> -Djava.library.path to my LD_LIBRARY_PATH but that did not help. I am
> wondering if there is any way we can specify the environment parameters in
> a config file.
>
> Thanks
>
> Sridhar
>
> snpe wrote:
>
>> Hi,
>> You haven\'t $ORACLE_HOME/lib in LD_LIBRARY_PATH or /etc/ld.so.conf,
>> probably I think that this work like oracle user on command line and then
>> installer set LD_LIBRARY_PATH for you
>
>> regards
>> Haris Peco
>
>> Sridhar wrote:
>
>> > I have a simple java program that gets a JDBC Connection. If I run this
>> > program on a command line it runs fine. However if it is run from the
>> > Eclipse debugger, I get runtime exception. I am wondering how to fix
>> > this problem.
>> >
>> > Thanks in advance.
>> >
>> > Sridhar
>> >
>> > Here is the code fragment I am using:
>> > try {
>> > String sDriver = \"oracle.jdbc.driver.OracleDriver\";
>> > String sURL = \"jdbc:oracle:oci8:@myDb\";
>> > String sUsername = \"myacct\";
>> > String sPassword = \"myPwd\";
>> >
>> > Class.forName( sDriver ).newInstance();
>> > Connection conn = DriverManager.getConnection ( sURL,
>> > sUsername,
>> > sPassword);
>> > }
>> > catch(Exception ex) {ex.printStackTrace();}
>> >
>> > Here is the exception I am getting:
>> >
>> > ld.so.1: oracleleap: fatal: libskgxp8.so: open failed: No such file or
>> > directory
>> > java.sql.SQLException: ORA-12547: TNS:lost contact
>> >
>> > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java: 168)
>> > at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:15 97)
>> > at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:354)
>> > at
>> > oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:246)
>> > at
>> >
>>
oracle.jdbc.driver.OracleDriver.getConnectionInstance(Oracle Driver.java:365)
>> > at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:26 0)
>> > at java.sql.DriverManager.getConnection(DriverManager.java:517)
>> > at java.sql.DriverManager.getConnection(DriverManager.java:177)
Re: JDBC problem [message #46431 is a reply to message #43750] Fri, 23 May 2003 13:26 Go to previous messageGo to next message
Sridhar is currently offline Sridhar
Messages: 12
Registered: July 2009
Junior Member
Hi,

Many Thanks for the suggestions.

I tried all the possible combinations. Looks like there is a fundamental
problem with eclipse being able to locate and load a library from the
LD_LIBRARY_PATH.

One of our friends was able to use an Oracle driver and it seems to be
fine.

I observed an interesting behavior, when I used
-Djava.library.path=$ORACLE_HOME/lib:$MY_LD_LIBRARY_PATH, it was able to
load oracle library, however it was complaining about another library file
not (one of our shared libs located) found (same error message as before
but complaining about a different library). Without Oracle stuff eclipse
loads our library fine.

Thanks

Sridhar


snpe wrote:

> Hi,
> You set LD_LIBRARY_PATH in .profile (or .bash_profile) like oracle user
> btw.
> export LD_LIBRARY_PATH=$OARCLE_HOME/lib
> Call eclipse after this
> You can thin driver,too - then You needn't oracle lib

> regards
> Harsi Peco
> Sridhar wrote:

> > Hi,
> >
> > Many Thanks for your response.
> >
> > I checked the \"java.library.path\" variable and it does include
> > $ORACLE_HOME/lib. However I noticed that the sequence of entries is not
> > the same as those in the environment of the shell that launched the
> > Eclipse IDE. In otherwords, Eclipse seems to be constructing its own
> > LD_LIBRARY_PATH (based on the environment variable). I tried to set
> > -Djava.library.path to my LD_LIBRARY_PATH but that did not help. I am
> > wondering if there is any way we can specify the environment parameters in
> > a config file.
> >
> > Thanks
> >
> > Sridhar
> >
> > snpe wrote:
> >
> >> Hi,
> >> You haven\'t $ORACLE_HOME/lib in LD_LIBRARY_PATH or /etc/ld.so.conf,
> >> probably I think that this work like oracle user on command line and then
> >> installer set LD_LIBRARY_PATH for you
> >
> >> regards
> >> Haris Peco
> >
> >> Sridhar wrote:
> >
> >> > I have a simple java program that gets a JDBC Connection. If I run this
> >> > program on a command line it runs fine. However if it is run from the
> >> > Eclipse debugger, I get runtime exception. I am wondering how to fix
> >> > this problem.
> >> >
> >> > Thanks in advance.
> >> >
> >> > Sridhar
> >> >
> >> > Here is the code fragment I am using:
> >> > try {
> >> > String sDriver = \"oracle.jdbc.driver.OracleDriver\";
> >> > String sURL = \"jdbc:oracle:oci8:@myDb\";
> >> > String sUsername = \"myacct\";
> >> > String sPassword = \"myPwd\";
> >> >
> >> > Class.forName( sDriver ).newInstance();
> >> > Connection conn = DriverManager.getConnection ( sURL,
> >> > sUsername,
> >> > sPassword);
> >> > }
> >> > catch(Exception ex) {ex.printStackTrace();}
> >> >
> >> > Here is the exception I am getting:
> >> >
> >> > ld.so.1: oracleleap: fatal: libskgxp8.so: open failed: No such file or
> >> > directory
> >> > java.sql.SQLException: ORA-12547: TNS:lost contact
> >> >
> >> > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java: 168)
> >> > at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:15 97)
> >> > at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:354)
> >> > at
> >> > oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:246)
> >> > at
> >> >
> >>
> oracle.jdbc.driver.OracleDriver.getConnectionInstance(Oracle Driver.java:365)
> >> > at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:26 0)
> >> > at java.sql.DriverManager.getConnection(DriverManager.java:517)
> >> > at java.sql.DriverManager.getConnection(DriverManager.java:177)
Re: JDBC problem [message #46623 is a reply to message #46431] Fri, 23 May 2003 17:19 Go to previous message
Haris Peco is currently offline Haris Peco
Messages: 1072
Registered: July 2009
Senior Member
Hi Sridhar,
Oracle lib isn't java lib.You must LD_LIBRARY_PATH out of eclipse (before
run eclipse) with :
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
run eclipse
or in .bash_profile
It is better that edit /etc/ld.so.conf (must be root) and add line :
/usr/oracle/lib
change /usr/oracle with ORACLE_HOME and call
ldconfig
then start eclipse
You must use thin JDBC driver URL like
jdbc:oracle:thin:user/password@hostname:1521:SID
then , You must set Oracle Net on port 1521 and sid SID
You must add jdbc jar in eclipse, too

regards
Haris Peco
Sridhar wrote:

> Hi,
>
> Many Thanks for the suggestions.
>
> I tried all the possible combinations. Looks like there is a fundamental
> problem with eclipse being able to locate and load a library from the
> LD_LIBRARY_PATH.
>
> One of our friends was able to use an Oracle driver and it seems to be
> fine.
>
> I observed an interesting behavior, when I used
> -Djava.library.path=$ORACLE_HOME/lib:$MY_LD_LIBRARY_PATH, it was able to
> load oracle library, however it was complaining about another library file
> not (one of our shared libs located) found (same error message as before
> but complaining about a different library). Without Oracle stuff eclipse
> loads our library fine.
>
> Thanks
>
> Sridhar
>
>
> snpe wrote:
>
>> Hi,
>> You set LD_LIBRARY_PATH in .profile (or .bash_profile) like oracle user
>> btw.
>> export LD_LIBRARY_PATH=$OARCLE_HOME/lib
>> Call eclipse after this
>> You can thin driver,too - then You needn't oracle lib
>
>> regards
>> Harsi Peco
>> Sridhar wrote:
>
>> > Hi,
>> >
>> > Many Thanks for your response.
>> >
>> > I checked the \"java.library.path\" variable and it does include
>> > $ORACLE_HOME/lib. However I noticed that the sequence of entries is not
>> > the same as those in the environment of the shell that launched the
>> > Eclipse IDE. In otherwords, Eclipse seems to be constructing its own
>> > LD_LIBRARY_PATH (based on the environment variable). I tried to set
>> > -Djava.library.path to my LD_LIBRARY_PATH but that did not help. I am
>> > wondering if there is any way we can specify the environment parameters
>> > in a config file.
>> >
>> > Thanks
>> >
>> > Sridhar
>> >
>> > snpe wrote:
>> >
>> >> Hi,
>> >> You haven\'t $ORACLE_HOME/lib in LD_LIBRARY_PATH or /etc/ld.so.conf,
>> >> probably I think that this work like oracle user on command line and
>> >> then installer set LD_LIBRARY_PATH for you
>> >
>> >> regards
>> >> Haris Peco
>> >
>> >> Sridhar wrote:
>> >
>> >> > I have a simple java program that gets a JDBC Connection. If I run
>> >> > this program on a command line it runs fine. However if it is run
>> >> > from the Eclipse debugger, I get runtime exception. I am wondering
>> >> > how to fix this problem.
>> >> >
>> >> > Thanks in advance.
>> >> >
>> >> > Sridhar
>> >> >
>> >> > Here is the code fragment I am using:
>> >> > try {
>> >> > String sDriver = \"oracle.jdbc.driver.OracleDriver\";
>> >> > String sURL = \"jdbc:oracle:oci8:@myDb\";
>> >> > String sUsername = \"myacct\";
>> >> > String sPassword = \"myPwd\";
>> >> >
>> >> > Class.forName( sDriver ).newInstance();
>> >> > Connection conn = DriverManager.getConnection ( sURL,
>> >> > sUsername,
>> >> > sPassword);
>> >> > }
>> >> > catch(Exception ex) {ex.printStackTrace();}
>> >> >
>> >> > Here is the exception I am getting:
>> >> >
>> >> > ld.so.1: oracleleap: fatal: libskgxp8.so: open failed: No such file
>> >> > or directory
>> >> > java.sql.SQLException: ORA-12547: TNS:lost contact
>> >> >
>> >> > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java: 168)
>> >> > at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:15 97)
>> >> > at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:354)
>> >> > at
>> >> >
oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:246)
>> >> > at
>> >> >
>> >>
>>
oracle.jdbc.driver.OracleDriver.getConnectionInstance(Oracle Driver.java:365)
>> >> > at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:26 0)
>> >> > at java.sql.DriverManager.getConnection(DriverManager.java:517)
>> >> > at java.sql.DriverManager.getConnection(DriverManager.java:177)
Re: JDBC problem [message #46802 is a reply to message #46431] Fri, 23 May 2003 15:09 Go to previous message
Mike Wilson is currently offline Mike Wilson
Messages: 21
Registered: July 2009
Junior Member
In article <ballk3$17b$1@rogue.oti.com>, kundurs@yahoo.com (Sridhar) wrote:

> <snip>
> Looks like there is a fundamental
> problem with eclipse being able to locate and load a library from the
> LD_LIBRARY_PATH.
> </snip>
>
I do this with other libraries regularly. If you believe there is a
problem, please enter a bugzilla report describing your situation in
detail.

Thanks,
McQ.
Previous Topic:Examples of supporting clipboard?
Next Topic:How to make my plugin use a different class loader?
Goto Forum:
  


Current Time: Thu Apr 17 00:00:35 EDT 2014

Powered by FUDForum. Page generated in 0.04775 seconds