Network Adapter Programming in Java
Hi all,
I need to send a signal from my computer to antoher computer using a Java program. The two computers are connected with the help of a network adapter (like an ethernet card). How can I do this in java? Is RMI helpful in this scenario? Any help or examples will be appreciated.
Hi,
I have two network adapters on the same computer
and I have configured them to use a parrrticular ip
addresses. Now I connected them using ethernet card.
I am using socket program to send the signal between
the two adapters. I have the problem like i get same
ip address for both client and server, ie i cannot
run client one ip address (10.1.1.1) and server on
the other ip address(10.1.1.2). Is there any other
way to approach the problem? Any suggestions?Is this for testing? If not please help me understand why you are using the network adapters and sockets instead of just communicating directly? Thanks
Similar Messages
-
Hello,
I have recently installed Weblogic6.1Sp1 server with Weblogic Intergration 2.1
on solaris 7 and im getting this error when connecting to the database (oracle816.3);
I have changed Oracle drivers and tried many different configurations, with no
luck, Could someone give me some guidance or has anyone encounted this error before.
Thanks
Bobby
java.sql.SQLException: Io exception: The Network Adapter could not establish the
connection]
java.sql.SQLException: Io exception: The Network Adapter could not establish the
connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:323)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:260)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at com.bea.wlpi.rdbmsrealm.RDBMSDelegate.<init>(RDBMSDelegate.java:187)
at com.bea.wlpi.rdbmsrealm.RDBMSDelegate$DFactory.newInstance(RDBMSDelegate.java:1177)
at weblogic.security.utils.Pool.getInstance(Pool.java:57)
at com.bea.wlpi.rdbmsrealm.RDBMSRealm.getDelegate(RDBMSRealm.java:104)
at com.bea.wlpi.rdbmsrealm.RDBMSRealm.getUser(RDBMSRealm.java:145)
at weblogic.security.acl.CachingRealm.getUserEntry(CachingRealm.java:806)
at weblogic.security.acl.CachingRealm.getUser(CachingRealm.java:670)
at weblogic.security.acl.internal.FileRealm.getPrincipalFromAnyRealm(FileRealm.java:1008)
at weblogic.security.acl.internal.FileRealm.ensureRequiredObjectsExist(FileRealm.java:957)
at weblogic.security.acl.internal.FileRealm.loadMembers(FileRealm.java:1202)
at weblogic.security.SecurityService.initializeRealm(SecurityService.java:274)
at weblogic.security.SecurityService.initialize(SecurityService.java:115)
at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:390)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:202)
at weblogic.Server.main(Server.java:35)Hi. This is definitely an oracle-only problem, so you should simplify the problem
down to a small standalone program using the oracle thin driver to make a connection.
Once you get this to work, weblogic will also be able to do it. Make sure that
when you try to have weblogic succeed after you can do it with oracle code only,
that the driver you used to succeed with, is ahead of any weblogic jars in
the server classpath. Note that we ship a classes12.zip in our packaging, but
Oracle has since released a newer one (with the same name!) that has some bugs
fixed. Make sure the later one is the one the JVM will pick up.
Joe
Bobby wrote:
>
Hello,
I have recently installed Weblogic6.1Sp1 server with Weblogic Intergration 2.1
on solaris 7 and im getting this error when connecting to the database (oracle816.3);
I have changed Oracle drivers and tried many different configurations, with no
luck, Could someone give me some guidance or has anyone encounted this error before.
Thanks
Bobby
java.sql.SQLException: Io exception: The Network Adapter could not establish the
connection]
java.sql.SQLException: Io exception: The Network Adapter could not establish the
connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:323)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:260)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at com.bea.wlpi.rdbmsrealm.RDBMSDelegate.<init>(RDBMSDelegate.java:187)
at com.bea.wlpi.rdbmsrealm.RDBMSDelegate$DFactory.newInstance(RDBMSDelegate.java:1177)
at weblogic.security.utils.Pool.getInstance(Pool.java:57)
at com.bea.wlpi.rdbmsrealm.RDBMSRealm.getDelegate(RDBMSRealm.java:104)
at com.bea.wlpi.rdbmsrealm.RDBMSRealm.getUser(RDBMSRealm.java:145)
at weblogic.security.acl.CachingRealm.getUserEntry(CachingRealm.java:806)
at weblogic.security.acl.CachingRealm.getUser(CachingRealm.java:670)
at weblogic.security.acl.internal.FileRealm.getPrincipalFromAnyRealm(FileRealm.java:1008)
at weblogic.security.acl.internal.FileRealm.ensureRequiredObjectsExist(FileRealm.java:957)
at weblogic.security.acl.internal.FileRealm.loadMembers(FileRealm.java:1202)
at weblogic.security.SecurityService.initializeRealm(SecurityService.java:274)
at weblogic.security.SecurityService.initialize(SecurityService.java:115)
at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:390)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:202)
at weblogic.Server.main(Server.java:35) -
Dear all,
I have been trying to connect to Oracle 8 from Java but without success.
I am using the following driver: oracle.jdbc.driver.OracleDriver
and the thin protocol as follows:
jdbc:oracle:thin:userid/password@databasename:1512:sid
I am getting the error message:
java.sql.SQLException: Io exception: The Network Adapter could not establish th
connection
I am using jdk1.3 with classes12.zip added to the classpath settings.
Can anybody help please.
Regards,
[email protected] or [email protected]
nullDear colleague,
I am using a stand alone database running on my windows 98 laptop.
I connect successfully via sql plus using the user id: scott and password tiger.
Below is the entry of my tnsname.ora:
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
I am finding difficult to specify a host, but I have tried the following combinations:
DriverManager.getConnection ("jdbc:oracle:thin:@koudry:1521:PLSExtProc","scott", "tiger");
where the machine name is koudry and PLSExtProc the sid.
DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:PLSExtProc","scott", "tiger");
and also 127.0.0.1 which is the ip address of the localhost. All these give me the following error:
Exception in thread "main" java.sql.SQLException: Io exception: The Network Adap
ter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:323)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:263)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at web.main(web.java:10)
When I use the oci protocol like:
DriverManager.getConnection ("jdbc:oracle:oci8:@127.0.0.1:1521:PLSExtProc","scott", "tiger");
I get the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: make_c_state
at oracle.jdbc.oci8.OCIDBAccess.make_c_state(Native Method)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:233)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:249)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at web.main(web.java:10)
Below is the entry for autoexec.bat:
set classpath=.;c:\oracle\ora81\jdbc\lib\classes12.zip;
mode con codepage prepare=((850) C:\WINDOWS\COMMAND\ega.cpi)
mode con codepage select=850
keyb uk,,C:\WINDOWS\COMMAND\keyboard.sys
SET Path=c:\Oracle\Ora81\lib;c:\Oracle\Ora81\bin;"C:\PROGRAM FILES\ORACLE\JRE\1.1.7\BIN";C:\WINDOWS;C:\WINDOWS\COMMAND;C:\;C:\DOS;C:\JDK1.3\BIN;C:\MSSQL7\BINN;C:\JDK1.3\SRC;
Can anyone see what I am doing wrong.
Thanks,
Richard Koudry
null -
Hi,
I know that there are a lot of threads with this error, but I don't know how to solve my situation yet.
I'm trying to access to the database via JDBC, and the driver return the following error:
java.sql.SQLException: IO Error: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:419)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:536)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:228)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:133)
at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.execute(OpenConnectionCommand.java:97)
at net.sourceforge.squirrel_sql.client.mainframe.action.ConnectToAliasCommand$SheetHandler.run(ConnectToAliasCommand.java:281)
- My oracle database is up and I can access to it with locally with TOAD
- I can do TELNET localhost 1521 in the server that has the DB installed
- I can do a successful ping from the client computer to the oracle server
- There aren't any firewalls between the client and the server.
- When I try to do TELNET <IP Address> 1521 from the client computer to the oracle DB Server, the connection could not be opened
- I tryed to do a TELNET to another port where I have another service, and the result has been successful. So the problem is related with the port 1521...
I don't have any knowledge about database administration, so I don't know what to do to solve this.
Can you help me please?java.sql.SQLException: IO Error: The Network Adapter could not establish the connectionThis preposterous error message is Oracle's way of saying either 'Connection refused' or 'Connection timeout' or 'no route to host' or 'unknown host'. However because of the stupidity of making up their own message instead of giving the original exception, it is impossible to say which. The pretentious wording is also stupid: network adapters don't create connections. TCP/IP stacks do that.
As to your problem, either there is no such host, no route to the host, nothing listening at the IP:port you specified, or there is a firewall in the way. And that includes a possible Windows firewall on the server host itself. -
Does anyone know what this error means?I have already installed Analyzer 6.5 on Win NT, on locally installed Tomcat web server and the oracle 9i database is on a solaris box.I think the problem is it is not able to connect to the oracle repository but I don't know how to fix it. Thanks,Haroon
Joe,
It may happen during testOnReserve, too.
Slava
"Joseph Weinstein" <[email protected]> wrote in message
news:[email protected]..
That means the Oracle URL you supplied to the pool is incorrect forconnecting to the
DBMS you want. If the same pool definition works sometimes and sometimesnot,
then it's an oracle problem with rapid connection requests. Make the poolmake all it's
connections at startup, by setting init=max, and this shouldn't happen.
Joe
Najib wrote:
Hi,
I am using a WebLogic Server 5.1. I created a connection pool to access
Oracle DB 8.1.7. It works fine but some times i have this pb :
Tue Apr 16 08:35:37 GMT 2002:<I> <JDBC Pool> Sleeping increateResource()
SQLException Pool connect failed: weblogic.common.ResourceException:
Could not create pool connection. The DBMS driver exception was:
java.sql.SQLException: Io exception: The Network Adapter could notestablish the connection
atoracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
atoracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
atoracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:323)
atoracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:260)
atoracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
atoracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
atweblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(Connection
EnvFactory.java:164)
atweblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(Connection
EnvFactory.java:123)
can some one help me please.
thinx. -
I recently upgraded from Redhat 9 to Fedora Core 4, and am running an Oracle 9i on this machine.
Since this upgrade, I'm unable to connect from the machine itself to the db, using the JDBC thin driver. This worked on Redhat 9.
I'm also able to connect from any other machine to this db with the JDBC driver.
Also, any ping, tnsping, sqlplus work from localhost and other machines.
Only the JDBC connection from the localhost itself fails, with following exception:
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:333)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404) at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at Jdbctest.main(Jdbctest.java:97)
*** SQLException caught ***
SQLState: null
Message: Io exception: The Network Adapter could not establish the connection
Error Code: 17002
In following URL - jdbc:oracle:thin:@myserver:1521:mydb - I tried 'localhost', '127.0.0.1', 'dns name', 'ip address', but all fail.
Any ideas would be highly appreciated (I'm searching for days now...)
Thanks in advance,
TimEtherrealTake this with a grain of salt; I know a lot of the theory but don't have much hands on experience...
Not a bad idea, but you need to understand more if it's going to work (it might not). Etherreal and most other sniffers work by capturing traffic at the network interface (NIC) level, this allows the NIC to be switched into "promiscuous" mode and capture all the network traffic "on the wire" in that network segment, even traffic destined for other machines.
You can think of "networking" as an onion, or a stack of layers (see "OSI 7 laye model", Google or http://www.webopedia.com/quick_ref/OSI_Layers.asp for one theoretical approach), and etherreal works at pretty "outside" ot "low" level; the "internal" traffic that your interested in seeing either never gets to the level that Etherreal is monitoring, or is doing so in an area that is parallel to the one you're monitoring.
It's possible that you might be able to configure etherreal to see the "loopback" traffic. I suspect that somewhere, you can specify which network interface is to be monitored, and you can change it to monitor the "local" network interface. If your Linux setup is typical, etherreal is probably monitoring interface "eth0" and you probably want to monitor "lo" to see local traffic.
You can find out what interfaces you have with the command:
ifconfig -a
On the Red Hat Entrerprise that I have, that command is not in the default PATH, but is in /sbin; on other flavors of Unix I know it is found in /usr/sbin
If you can get etherreal monitoring the local interface, you should be able to see the traffic generated by "ping 127.0.0.1"
BTW, that command will also give you raw counts of the number of packets on all interfaces; if you have the machine to yourself, you might try a connection attempt and see which (if any) interfaces have packet numbers increase; if none do, then the connection attempt is failing before it gets to the packet level and Etherreal won't tell you anything. -
Hi Friends,
I am installing Java Addin to ECC 6.0 SR3 on Solaris 5.10(Oracle 10.2).
SCS Addin i have completed.Right now i am facing issue when installing DB Addin Java in phase -->
Java Import--->
08.01.09 00:23:39 com.sap.inst.jload.Jload logStackTrace
SEVERE: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
I have captured this error in jload.log
As per SAP Note 969660 i have restarted the Listener but still no luck..
Could any one aware of this issue.
Thanks
Siva
9885704611Hai,
Check the below links, may be helpful.....
http://www.websina.com/bugzero/kb/oracle-connection.html
/thread/498275 [original link is broken]
Regards,
Yoganand.V -
Hello all!
First of all, I want to say I read all the answers to this problem that were posted in the past in this forum.
I try to connect from the intranet to an Oracle database, named bc01. The string I use is "jdbc:oracle:thin:@192.168.199.11:1521:bc01". On the 192.168.199.11 machine the listener and oracleservice services are started. The bc01 is correctly added to tnsnames.ora. If I issue a tnsping80 192.168.199.11 from the console it works. However, if I issue the same command from my workstation, it doesn't work (says No listener). So what am I missing here?
Any help is much appreciated !
Thank you very much!Faizan,
Normally this error is reported when the database is either not available or the URL is invalid. Please check the URL whether you have a valid DB connection there.
Also I see the getConnection missing e,g.
Connection conn = ds.getConnection();
regards
Debu
I am trying to setup DataSource for my application and I am using oracle 8.1.6.3 database. I have following entry in the data-sources.xml file
<data-source
class="oracle.jdbc.pool.OracleDataSource"
name="jdbc/pool/OracleDS"
location="jdbc/ConnectionDS"
pooled-location="jdbc/pool/OracleDS"
url="jdbc:oracle:thin:@machine:1521:development"
username="user"
password="password"
min-connections="3"
max-connections="50"
wait-timeout="10"
inactivity-timeout="30"
/>
In my JSP code I am doing following to access the database
ResultSet sqlResultSet = null;
PreparedStatement stm = null;
InitialContext ic = new InitialContext();
DataSource ds = (DataSource)ic.lookup("jdbc/OracleDS");
stm = conn.prepareStatement(updtUser);
I got following exception when I ran teh code
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
Thanks for help
Faizan -
Hi,
I run java application on one Sun Solaris (5.8) server and call Oracle 8.1.6 MTS database on another Sun Solaris (5.8) server.
When I am using jdbc:oracle:thin:@host:port:sid, I got:
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection.
So, I changed to jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=hostip)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=databasename)(SERVER=DEDICATED))). It works.
But, when I tested java application with jdbc:oracle:thin:@host:port:sid on other Sun Solaris 5.8 server, using same classes12.zip and connect to same MTS database, all of them worked.
Right now, there is only one Sun server does not work with jdbc:oracle:thin:@host:port:sid format. And on this SUn server, using jdbc:oracle:thin:@host:port:sid format connect to other dedicated Oracle database is fine.
Thanks for your help advance.
PaulThis is going to sound stupid, but have you made sure that the server that couldn't connect resolved the name of the database server correctly? We had some problems with some of our field offices not correctly resolving the IP address for our server when the name was given. I would first try and put the IP address for the server/host name:
jdbc:oracle:thin:@1.1.1.1:port:sid
That's just a thought, hope it works for you. -
I am using Oracle 9i Server just the
Weblogic 5.1 and also using Oracle 8.1.6 client for weblogic. When I start the weblogic application I am getting the following error message
"java.sql.SQLException: Io exception: The Network Adapter could not establish the co
nnectionOn 10 Feb 2003 09:51:52 -0800, Shankar Viswanathan
<[email protected]> wrote:
I am using Oracle 9i Server just the
Weblogic 5.1 and also using Oracle 8.1.6 client for weblogic. When I start the weblogic application I am getting the following error message
"java.sql.SQLException: Io exception: The Network Adapter could not establish the co
nnection
"You're not providing a lot of information here, but I'll assume a few
things and say...
Ensure the URL param is set properly in the pool def. Check hostname,
port and database/TNS entry. Also, try dbpinging the database with the
following:
java utils.dbping ORACLE <user> <password> <dbname>
substitute the appropriate values where necessary. For example, I have
a TNS def called 'jforum.world' for a particular oracle instance. User
is 'auser' and the password is 'apass'. The following command will
test the connection:
java utils.dbping ORACLE auser apass jforum.world
Alternatively, you can try tnsping, an oracle util, to test the
connectability.
If either of these utils work, then it's probably a typo somewhere in
the pool properties.
Bon -
actually I changed the hostname for plesk. when I restarted the server then error appears:
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
thanks & best regards1) What is "plesk"?
2) java.sql.SQLException implies that you have a Java application using JDBC to connect to the database. That would seem to imply that this has nothing to do with ODBC.
3) When the JDBC driver raises this error, there should be additional information about what particular Oracle error was raised. Do you have that information?
4) Can you connect to the database using a different application? Like SQL*Plus, for example?
5) Taking a wild guess, I'd tend to suspect that you would need to change the host name configured for the client's connection string. That might be in your tnsnames.ora file, it might be in a n application config file, it might be in an application dialog, or that information may have been embedded into the application.
Justin -
Status Failure -lo exception:network adapter could not establish connection
Hi, installed SQL DEVELOPER today and its driving me mad... I am getting this error
Status Failure -lo exception:network adapter could not establish connection.
Basic tab I have all the right information, tried test gives same error...
hostname ajas
port 1521
sid altaf
TNS
Network alias altaf
connect identifier altaf(TRIED SINCE NETW ALIAS DIDNT WORK)
went to TNS tab and from the list selected the right entry for NETWORK ALIAS,tried test still same error... tested with connect identifier still same error...went to Advanced entered this string jdbc:oracle:thin:@ajas:1521:altaf ..... still same error...what the hell is wrong...here is the tnsnames.ora entry ...
ALTAF =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = AJAS)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = altaf)
by the way I am able to connect with sql*plus ... lsnrctl gives the lsnr so thats running... tnslsnr is also running...also installed the latest java sdk i.e 1.5... i have set new path to point to this new java.exe i.e 1.5 one... this is really crazy and havent see such probs in any tools i have ever used and that too using it in normal pc ... God knows what will happen if used for remote db's....
here is listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = AJAS)(PORT = 1521))
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oracle\ora92)
(PROGRAM = extproc)
(SID_DESC =
(GLOBAL_DBNAME = altaf)
(ORACLE_HOME = C:\oracle\ora92)
(SID_NAME = altaf)
no one seems to have answer for this... there are all kinds of strange replies for this problem.... anyone has solved this prob plz reply....
Message was edited by:
ajashadiI've had the same problem when I installed the latest version of SQL developer (1.2.1.32.13) on a machine that still had an older, working version. My problem went away when I changed from an IP name to an IP address. on the connection setup window.
-
Network adapter could not establish the connection
Hi,
Iam new to using Oracle please help me in this problem. Iam trying to connect oracle8i in my home pc(win 98) in java.. I have said..
String url="jdbc:oracle:thin:@testhost:1521:sid";
DriverManager.getConnection(url,"scott","tiger");
Actually i have added the service name using Oracle Net 8 Assistant ... it asked me service name so i gaved "fobjects". then host and port number then i gave "testhost" and port number as 1521. then i tried to use the test service but i couldnt get it... it gaved me error called " ORA12545- Connect failed because target host or obejct doe not exist ..Even then i pressed finished button to accomplish the thing...ans when i executed the java program with the above service name setup it said SO Excpetion : Network adapter could not establish the connection.
Well What the wrong i have done, help me...
Regards
Lensi.hi,
I think you have to register the driver first. pls try the following program...
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
* This class tests the environment to check if JDBC is configured and
* connection to database is possible thru JDBC. Uses THIN driver to connect.
public class JDBCCheck {
public JDBCCheck() { }
private Connection conn = null;
private final int NO_DRIVER = 1;
private final int INVALID_URL = 17002;
private final int INVALID_CREDENTIALS = 1017;
private final int NULL_URL = 2;
private final int DATABASE_DOWN = 1034;
public static void main(String[] args) {
JDBCCheck check = new JDBCCheck();
check.dbconnect();
public void dbconnect() {
if(loadDriver())
if(connect())
doSomething();
public boolean loadDriver() {
boolean loadeddriver = false;
String jdbcDriver = System.getProperty("jdbc.driver.class");
// Use Oracle driver if nothing is set
if(jdbcDriver == null) jdbcDriver = "oracle.jdbc.driver.OracleDriver";
log("Loading JDBC Driver : class="+jdbcDriver+" ...");
// try to load driver
try {
Class.forName(jdbcDriver);
log("Loaded JDBC Driver ");
loadeddriver = true;
} catch (ClassNotFoundException noclassEx) {
error(NO_DRIVER,noclassEx);
return loadeddriver;
public boolean connect() {
boolean connected = false;
String jdbcURL = System.getProperty("jdbc.url");
String username = System.getProperty("jdbc.username");
String password = System.getProperty("jdbc.password");
if(username == null || password== null) {
username = "scott";
password = "tiger";
if(jdbcURL == null) error(NULL_URL,new Exception(" jdbc.url cannot be null "));
log("Connecting with URL="+jdbcURL+" as "+username+"/"+password);
try {
conn = DriverManager.getConnection(jdbcURL,username,password);
log("Connected to Database");
connected = true;
} catch (SQLException sqlEx) {
error(sqlEx.getErrorCode(),sqlEx);
return connected;
public void doSomething() {
Statement stmt = null;
ResultSet rset = null;
try {
stmt = conn.createStatement();
log("Created Statement object");
rset = stmt.executeQuery(" SELECT 'PASSED' FROM Dual ");
log("Retrieved ResultSet object");
if(rset.next())
log("Connection :"+rset.getString(1));
} catch (SQLException sqlEx) {
} finally {
try {
log("Closing Statment & ResultSet Objects");
if (rset != null) rset.close();
if (stmt != null) stmt.close();
if (conn != null) {
log("Disconnecting...");
conn.close();
log("Disconnected from Database");
} catch (Exception e) { }
public void log(String logMsg) {
System.out.println("Log: "+logMsg);
public void error(int errcode, Exception ex) {
String jversion = System.getProperty("java.version").substring(0,3);
String os = System.getProperty("os.name");
String excp = ex.toString();
// Driver not found in classpath
if(errcode == NO_DRIVER) {
String jarname = "classes12.jar";
String nlsjarname = "nls_charset12.jar";
if(jversion.equals("1.1")) {
jarname = "classes111.jar";
nlsjarname = "nls_charset11.jar";
else if(jversion.equals("1.4"))
jarname = "ojdbc14.jar";
System.out.println(" Error: JDBC Drivers not present in CLASSPATH ");
System.out.println("\n Your CLASSPATH is :"+System.getProperty("java.class.path"));
System.out.println("\n To add Oracle JDBC Drivers to CLASSPATH ");
// Windows
if(os.indexOf("Windows") != -1) {
System.out.println(" >set CLASSPATH=<path-to-"+jarname+">;<path-to-"+
nlsjarname+">;%CLASSPATH%;");
} else {
System.out.println(" $CLASSPATH=<path-to-"+jarname+">:<path-to-"+
nlsjarname+">:$CLASSPATH:");
System.out.println(" $export CLASSPATH");
System.out.println(" Oracle JDBC Drivers can be found in "+
"<ORACLE_HOME>/jdbc/lib directory or "+
"downloaded from http://otn.oracle.com/software/");
} else if (errcode == NULL_URL) {
System.out.println("Error: jdbc.url was not supplied");
System.out.println("Usage: java -Djdbc.url=jdbc:oracle:thin:@<hostname>:<port>:<db_sid> JDBCCheck ");
} else if (errcode == INVALID_URL) {
// Check if Invalid Database SID
if( excp.indexOf("ERR=12505") != -1)
System.out.println("Error: Invalid Database SID was specified in jdbc.url ");
System.out.println("Error: Invalid JDBC URL or DB Listener is down, refer to http://myjdbc.tripod.com/basic/jdbcurl.html ");
} else if (errcode == INVALID_CREDENTIALS) {
System.out.println("Error: Invalid username/password was specified ");
System.out.println("Try connecting to the database thru SQL Plus using the same username/password");
} else if (errcode == DATABASE_DOWN ) {
System.out.println("Error: The Database you are tying to Connect is down ");
System.out.println(" Start the Database and then try to connect ");
} else {
System.out.println("Error code not handled : "+errcode);
System.out.println("\nException Message :"+excp);
System.exit(0);
while running thig pgm, you should pass the driver URL..
java -Djdbc.url=jdbc:oracle:thin:@<hostname>:<port>:<db_sid> JDBCCheck -
Jdbc. The Network Adapter could not establish the connection. Help Please!!
I've found several responses over this issue, but none works for me.
I'm trying to setup a simple jdbc connection from a simple program.
Platform:
Fedora Core 4 (FC4) on AMD 64 bits
Java 1.4.2_04 (64 bits)
ORacle 10g or Oracle 9.2.0.4 (none works);
Tips:
- I can't connect to a remote server, nor to a local server
- I can connect using SQLplus
- TNSPing works fine
- Listener it's up
- my connection string is jdbc:oracle:thin:user/name@host:port:sid
- Also try jdbc:oracle:thin:user/name@//host:port/sid
- I'v tryied with classes12.jar, odbj14.jar
- my hostname it's ok.
I've monitored ip traffic on remote computer. While using TNSPING I detect activity. While using jdbc, no.
Please, any idea??Thanks for your reply.
To your questions:
- I´v tried both IP, host, and even host.domain
- I can connect from remote workstation using toad, and from local using sqlplus.
- I can´t connect via jdbc.
Folowing:
A) my sample code
B) the stack trace
C) the listener status (from my 9i server. Also tryied another servr with 10g)
when I call this program, I´ve tried severl connection strings:
jdbc:oracle:thin:user/pass@sdd51:1521:ebf
jdbc:oracle:thin:user/pass@:sdd51.sdd.com.ar:1521:ebf
jdbc:oracle:thin:user/pass@:10.10.10.51:1521:ebf
also try the other sintax:
jdbc:oracle:thin:user/pass@//sdd51:1521/ebf
In the classpath, I´tryied:
clasess12.jar
ojdbc14.jar
nls_charset12.jar
thanks
A)=================================================
// Import the JDBC classes
import java.sql.*;
import oracle.jdbc.pool.OracleDataSource;
import java.io.*;
import java.util.*;
public class test
// The query we will execute
static final String query = "select 'Hello JDBC: ' || sysdate from dual";
// The connection to the database
static Connection conn;
// Create the User Interface
static public void main (String args[])
try {
String connect_string = args[0];
// See if we need to open the connection to the database
if (conn == null)
// Create a OracleDataSource instance and set URL
OracleDataSource ods = new OracleDataSource();
ods.setURL(connect_string);
// Connect to the databse
System.out.println ("Connecting to " + connect_string + "\n");
conn = ods.getConnection ();
System.out.println ("Connected\n");
// Create a statement
Statement stmt = conn.createStatement ();
// Execute the query
System.out.println ("Executing query " + query + "\n");
ResultSet rset = stmt.executeQuery (query);
// Dump the result
while (rset.next ())
System.out.println (rset.getString (1) + "\n");
// We're done
System.out.println ("done.\n");
catch (Exception e)
e.printStackTrace();
// Oops
System.out.println (e.getMessage () + "\n");
B)=================================================
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:212)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:251)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:224)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:102)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:85)
at test.main(test.java:66)
C)=================================================
LSNRCTL for Linux: Version 9.2.0.1.0 - Production on 30-JAN-2006 17:39:59
Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(PORT=1521))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version 9.2.0.1.0 - Production
Start Date 24-JAN-2006 11:16:18
Uptime 6 days 6 hr. 23 min. 40 sec
Trace Level off
Security OFF
SNMP OFF
Listener Log File /opt/oracle/product/9.2.0/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sdd51.sdd.com.ar)(PORT=1521)))
Services Summary...
Service "ebf" has 1 instance(s).
Instance "ebf", status READY, has 1 handler(s) for this service...
The command completed successfully -
Network Adapter could not establish
I am having some problems making a jdbc connection between oracle and java on a Solaris box. I keep getting this sqlexception error during runtime?
Network Adapter could not establish
the connection
Any help would be greatly appreciated.Hai there!
Iam having the same error. N/W adapter could not establish the connection (NULL pointer exception)
Iam using win98 & oracle8.1.5.
When i try to access datbase from oracle thr' Java it gives runtime error.
There is no firewall in my system.
I don't know how to run the oracle listener. Iam new user for JDBC. Please help me.
Sometimes it gives "not suitable driver".
My coding is
/**DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());*/
Connection conn = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@67.192.41.17:1521:newemployee","scott","tiger");
} catch (Exception e) {
System.out.println(e + "");
} finally {
try {
conn.close();
} catch (Exception e) {
System.out.println(e + "");
"you should have an entry for your database in tnsnames.ora file.Ask your dba about the name ,port etc.,"
Please explain this line clearly.
If possible send me a program & all the steps to run that program.
Please help me.
Thanks in advance
sakthy
Maybe you are looking for
-
I can't open pdf files I have down-loaded from Safari
I can't open pdf files I have down-loaded from Safari (6.0 and OSX 10.8) with preview or acrobat. I get a corrupted file message. Anyone have a fix?
-
Hi, We are planning to install SRM server 5.5 (ABAP). Could you please help me to resolve the issue? 1.) BI Content should be installed on SRM server or we have to use external BW system? 2.) We have configired SLD using RZ70. Do we need to check
-
Why must I force quit (double press home and slide off) Mail on both my iPad and iPhone in order to have Mail access on my iMac on the same wifi network. Fetch is set to manual and my ISP is Charter.
-
Can't sign in when trying to install the Elements 13 upgrade.
Purchased the upgrade fro PSE 12 to PSE 13, if has downloaded, when I try to install if asks me to sign in, it just stays thinking about signing in for ages and doesn't go any further.
-
Time Machine error message despite being disabled
Hey So, despite having time machine completely disabled in my system settings and killing the backupd process, I still get a popup warning from Time Machine trying to run and complaining about not being able to find the Time Machine disk. I've follow