Welcome Guest ( Log In | Register )


 
 
 
 
 
 

 
 
Oracle 

Performance Tuning Reference poster
 
Oracle training in Linux 

commands
 
Oracle training Weblogic Book
 
Easy Oracle Jumpstart
 
Oracle training & performance tuning books
 
Burleson Consulting Remote DB Administration
 
 
 
Reply to this topicStart new topic
> NL Exception trying to connect to 10g RAC w/JDBC
naijaguy
post Jan 11 2005, 02:17 PM
Post #1


Advanced Member
***

Group: Members
Posts: 40
Joined: 10-December 04
Member No.: 1,123



I'm trying to connect to multiple Oracle 10g databases (failover) over the JDBC thin client, and when I run the following, I get:
java.sql.SQLException: Io exception: NL Exception was generated


connection = DriverManager.getConnection("jdbc:oracle:thin:@DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = dbdev) (PORT = 1521))) (CONNECT_DATA = (INSTANCE_NAME = orcldev)))", "scott", "tiger");


I eventually want to put multiple ADDRESSes in that string, but right now I'm trying to get it to work with just one! I've tried multiple variations of this, like changing INSTANCE_NAME to SID or SERVICE_NAME, and using the internal IP address for the HOST dbdev (see below). Here's the tnsnames.ora file used by SQL*Plus on the same client machine:

ORCLDEV.world =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.132)(PORT = 1521))
(CONNECT_DATA =
(SID = orcldev)
)
)
Go to the top of the page
 
+Quote Post
dereklu
post Jan 11 2005, 03:15 PM
Post #2


Advanced Member
***

Group: Members
Posts: 131
Joined: 3-January 05
Member No.: 1,202



Try using oracle tnsname instead of hard code the connection in your program. when failover you can play around tnsname.ora without changing your program....

exmp:
....
java.sql.Connection conn = null;
private static final String jdbc_driver_name = "oracle.jdbc.driver.OracleDriver";
String dbUrl="jdbc:oracle:thin:@yourhost:port#:SID";
String dbUser="scott";
String pwd="tiger";

....
conn = DriverManager.getConnection( dbUrl, dbUser, pwd );
.......

Here the SID is your "oracledev.world"....
Go to the top of the page
 
+Quote Post
burleson
post Jan 11 2005, 03:31 PM
Post #3


Advanced Member
***

Group: Members
Posts: 11,614
Joined: 26-January 04
Member No.: 13



smile.gif

Hi,

With RAC it can be a pain, especially if you are using TAF.

Can you hard-connect to just one node?

Did you test the tns entry with tnsping and sqlplus?

tnsping orcldev

sqlplus /nolog
connect system/manager@orcldev

If so, just copy right-out of a working tnsnames.ora file.


--------------------
Hope this helps. . .

Donald K. Burleson
Oracle Press author
Author of Oracle Tuning: The Definitive Reference
Go to the top of the page
 
+Quote Post
naijaguy
post Jan 11 2005, 04:31 PM
Post #4


Advanced Member
***

Group: Members
Posts: 40
Joined: 10-December 04
Member No.: 1,123



I got that syntax for connecting to an address list of 10g servers over JDBC from the Oracle Technology Network site, and it's not working for me. You can see that I'm trying to use the same info that's in my tnsnames.ora file that is used when connecting over SQL*Plus from the same machine that the Java web app is on. Any ideas why this is not working for me?
Go to the top of the page
 
+Quote Post
burleson
post Jan 11 2005, 05:19 PM
Post #5


Advanced Member
***

Group: Members
Posts: 11,614
Joined: 26-January 04
Member No.: 13



smile.gif

Hi,

OK, here you go:

jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)))(HOST=host
)(PORT=port)
(CONNECT_DATA=(SERVICE_NAME=sid)(SERVER=DEDICATED))

Adding SERVER=DEDICATED should do it (see below)

**********************************


Doc ID: Note:139775.1
Subject: JDBC Connection Failure: Network Adapter Could not Establish Connection
Type: PROBLEM
Status: PUBLISHED

Content Type: TEXT/PLAIN
Creation Date: 13-APR-2001
Last Revision Date: 09-NOV-2004

PROBLEM

-------

You are attempting to connect to an Oracle instance using JDBC

and you are receiving the following error.

java.sql.SQLException: Io exception:

The Network Adapter could not establish connection

SQLException: SQLState (null) vendor code (17002)

Any or all of the following conditions may also apply:

1) You are able to establish a SQL*Plus connection from the same

client to the same Oracle instance.

2) You are able to establish a JDBC OCI connection, but not a Thin

connection from the same client to the same Oracle instance.

3) The same JDBC application is able to connect from a different

client to the same Oracle instance.

4) The same behavior applies whether the initial JDBC connection

string specifies a hostname or an IP address.

REDISCOVERY

-----------

To verify whether you are hitting this problem, verify whether the

Oracle instance is configured for Multithreaded Server (MTS).

If the Oracle instance is not configured for MTS, you are probably

encountering a different problem. Otherwise, continue.

Try forcing the JDBC connection to use a dedicated server instead

of a shared server. This can be accomplished in several ways.

For JDBC OCI or Thin, this can be done by reconfiguring the server

for dedicated connections only. This approach, however, may not be

feasible in many cases. In such cases, the following options apply:

For JDBC OCI:

1) Add the (SERVER=DEDICATED) property to the TNS connect string

stored in the tnsnames.ora file on the client.

2) Set the user_dedicated_server=ON in sqlnet.ora on the client.

For JDBC Thin:

You must specify a full name-value pair connect string (the same

as it might appear in the tnsnames.ora file) instead of the short

JDBC Thin syntax. For example, instead of

"jdbc:oracle:thin:@host:port:sid"

you would need to use a string of the form

"jdbc:oracle:thin:@(DESCRIPTION=" +

"(ADDRESS_LIST=" +

"(ADDRESS=(PROTOCOL=TCP)" +

"(HOST=host)" +

"(PORT=port)" +

")" +

")" +

"(CONNECT_DATA=" +

"(SERVICE_NAME=sid)" +

"(SERVER=DEDICATED)" +

")" +

")"

If the connection works fine after having made these changes, it

is very likely that this is the problem you are encountering. In

this case, one last test will help to verify this fact.

Log into the remote host on which the Oracle instance is running

and execute the appropriate command to determine what the server

'thinks' its hostname is (i.e. the name that was configured when

the server was installed and configured). For example, on a Unix

host the 'hostname' command can be used for this purpose.

Using the name displayed (e.g. by the hostname command), exactly

as it appeared (i.e. if the output from the hostname command had

the domain name included, then include it), return to the client

which was unable to connect and try pinging the server.

NOTE: It is critical that you attempt to ping the server using

EXACTLY the same hostname you got from the server.

If you are unable to ping the server via this hostname, then you

almost certainly hitting this problem. If not, this may be a new

issue, but at least you will have found a workaround (i.e. use a

dedicated connection).

EXPLANATION

-----------

To understand why this problem occurs, one must first understand

the differences in how the listener handles connections to shared

servers versus dedicated servers.

When connecting to a dedicated server, the client connects to the

listener (via hostname or IP address). The listener then spawns a

dedicated server process and hands off the socket used to accept

the client connection to that server. The client and server then

start communicating via the endpoints established by the initial

connection. NOTE: There is only one connection in this case.

When connecting to a shared server, the initial client connection

to the listener is the same. However, with MTS, there is no need

to spawn a new server process; a pool of shared processes already

exists. Also, clients do not communicate directly with the server

processes in MTS; rather, they communicate with a dispatcher.

For this reason, when setting up an MTS connection, the listener

sends a redirect message back to the client asking the client to

close the connection to the listener and connect to a dispatcher.

The information in this message includes the hostname and a port

number for the appropriate dispatcher. The redirect message will

ALWAYS specify a hostname, even if the client initially provided

an IP address.

If, for any reason, the hostname provided to the listener (e.g. by

the 'hostname' or another command) doesn't agree with the hostname

by which the server is known on the client, the connection fails.

On the other hand, if "(SERVER=DEDICATED)" already appears in the

TNS connect string in tnsnames.ora or if "use_dedicated_server=ON"

already appears in the sqlnet.ora file, you may find that SQL*Plus

and/or JDBC OCI work fine, while JDBC Thin fails.

SOLUTION

--------

Obviously, one solution is to use dedicated servers. However, this

may not always be feasible.

The key is to make sure the hostname on both the client and server

ag ree. This can be accomplished by reconfiguring either the client

or the server, but there are things to be aware of in both cases.

If the server is configured to return a different hostname, then it

is possible that other clients which used to work will now fail.

In some cases, it may not be feasible to reconfigure the client. For

example, if the server version of the hostname does not include the

domain, you would need to remove the domain portion of the hostname

on the client; but, if the client needs to connect to more than one

server with the same base name in different domains, this may not be

possible, as the hostname may be ambiguous.


--------------------
Hope this helps. . .

Donald K. Burleson
Oracle Press author
Author of Oracle Tuning: The Definitive Reference
Go to the top of the page
 
+Quote Post
naijaguy
post Jan 12 2005, 08:40 PM
Post #6


Advanced Member
***

Group: Members
Posts: 40
Joined: 10-December 04
Member No.: 1,123



Thanks! biggrin.gif
Go to the top of the page
 
+Quote Post
vamsiKD
post Apr 9 2012, 01:29 AM
Post #7


Newbie
*

Group: Members
Posts: 1
Joined: 9-April 12
Member No.: 47,055



Hi,

I have weblogic installed on my machine and when trying to connect to DB linke dwith managed server, it is throwing error as

Apr 5, 2012 5:13:33 PM IST> <Failure occurred in the execution of deployment request with ID '1333626211843' for task 'weblogic.deploy.configChangeTask.6'. Error is: 'weblogic.application.ModuleException: '
weblogic.application.ModuleException:
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:289)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerI
nvoker.java:93)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:
37)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCall
backFlow.java:58)
Truncated. see log file for complete stacktrace
weblogic.common.ResourceException: weblogic.common.ResourceException: Could not create pool connection. The DBMS driver exception was: Io exception: NL Exception was generated
at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvF
actory.java:253)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.jav
a:1109)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.jav
a:1033)
at weblogic.common.resourcepool.ResourcePoolImpl.start(ResourcePoolImpl.java:214)
at weblogic.jdbc.common.internal.ConnectionPool.doStart(ConnectionPool.java:1051)
Truncated. see log file for complete stacktrace

I have set the classpath for weblogic and tried to ping the DB, but its has given me the exception as

Error encountered:
java.sql.SQLRecoverableException: Io exception: NL Exception was generated
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:101)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:458)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:411) at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:490)
at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:202)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:474)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at utils.dbping.main(dbping.java:192)

I am using the following JDBC Connection

jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=XXXXXXXX)(PORT=1721)
)(ADDRESS=(PROTOCOL=TCP)(HOST=XXXXXXX)(PORT=1721))(LOAD_BALANCE=yes)(CONNECT_DATA
=(SERVER=DEDICATED)(SERVICE_NAME=XXXX)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(
RETRIES=180)(DELAY=5))))


Could anyone please help me. This is something urgent for me

Regards,
Vamsi
Go to the top of the page
 
+Quote Post
burleson
post Apr 9 2012, 09:23 AM
Post #8


Advanced Member
***

Group: Members
Posts: 11,614
Joined: 26-January 04
Member No.: 13



Hi Vamsi,

- Why re-open an old thread from 2005 that has nothing to do with your question?
Here is your error:

Io exception:

Please re-post this as a new thread.


--------------------
Hope this helps. . .

Donald K. Burleson
Oracle Press author
Author of Oracle Tuning: The Definitive Reference
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 22nd October 2014 - 06:50 PM