File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes OracleDatasource with Eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "OracleDatasource with Eclipse" Watch "OracleDatasource with Eclipse" New topic
Author

OracleDatasource with Eclipse

piyush kumar
Greenhorn

Joined: Feb 01, 2007
Posts: 20
Hi all,

I am getting this stacktrace while conecting my java to oracle. I am using eclipse 3.3, oracle9i and java1.5.

the stacktrace is as follows:

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)
at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TTC7Protocol.java:3668)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:353)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:371)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:551)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:351)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:169)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:105)
at web.persistent.ConMgmt.getConnection(ConMgmt.java:21)
at web.persistent.TestConnection.main(TestConnection.java:21)
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]


also while debuging the program it is stucking to a line where i say
ds = new OracleDataSource(); // it is sayig source not found while comming to this line.

SOurce Code:

public class ConMgmt
{
private static OracleDataSource ds;
public static Connection getConnection() throws SQLException
{
if(ds==null)
{
ds=new OracleDataSource();
ds.setUser("scott");
ds.setPassword("tiger");
ds.setURL("jdbcracle:thin:@localhost:1521radb");
System.out.println(ds.getLoginTimeout());
}
return ds.getConnection();
}
piyush kumar
Greenhorn

Joined: Feb 01, 2007
Posts: 20
Originally posted by piyush kumar:
Hi all,

I am getting this stacktrace while conecting my java to oracle. I am using eclipse 3.3, oracle9i and java1.5.

the stacktrace is as follows:

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)
at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TTC7Protocol.java:3668)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:353)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:371)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:551)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:351)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:169)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:105)
at web.persistent.ConMgmt.getConnection(ConMgmt.java:21)
at web.persistent.TestConnection.main(TestConnection.java:21)
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]


also while debuging the program it is stucking to a line where i say
ds = new OracleDataSource(); // it is sayig source not found while comming to this line.

SOurce Code:

public class ConMgmt
{
private static OracleDataSource ds;
public static Connection getConnection() throws SQLException
{
if(ds==null)
{
ds=new OracleDataSource();
ds.setUser("scott");
ds.setPassword("tiger");
ds.setURL("jdbcracle:thin:@localhost:1521radb");
System.out.println(ds.getLoginTimeout());
}
return ds.getConnection();
}


Hello all

My above problem is solved by some cofiguration settings for oracle. I started "lsnrctl.exe" file from oracle home and the problem got resolved as the exe file was on the stopped status in the services. But now a new problem is coming this "lsnrctl.exe" is using port 8080 for some of its listening endpoints so while this is running my application server JBoss cannot run. Can anybody please let me know if i can change the port of JBoss server and How? or else any other solutionto this problem.

Thanks in advance
piyush
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OracleDatasource with Eclipse
 
Similar Threads
Connection not available
DataSource Problem
java.sql.SQLException: Protocol violation
exception while connecting to the database
TNSAddress.SOException