[nbusers] Oracle connection failure, none for java app, yes for java desktop app

  • From: "mikeh" < >
  • To:
  • Subject: [nbusers] Oracle connection failure, none for java app, yes for java desktop app
  • Date: Wed, 31 Mar 2010 20:03:18 +0000

Hi-

I'm trying to connect to an oracle database using the thin protocol.  This is 
the relevant code:

Code:

Connection con=null;

 try {
      DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
      try {
            Class.forName("oracle.jdbc.OracleDriver");
      } catch (ClassNotFoundException ex) {
Logger.getLogger(DocumentEditorView.class.getName()).log(Level.SEVERE, null, 
ex);
            }
            System.out.println("Attempting connection...");

            con = 
DriverManager.getConnection("jdbc:oracle:thin:@//x.x.x.x:1521/sid", "myacct", 
"mypw");
            System.out.println("Connection success!");

        } catch (SQLException ex) {
            System.out.println("Error in Connection to network, please try 
again");
Logger.getLogger(DocumentEditorView.class.getName()).log(Level.SEVERE, null, 
ex);
            System.exit(1);
        }




Note that the class name is the NetBeans sample code DocumentEditor ... not a 
coincidence.  I inserted the same bit of code into the NetBeans Anagram 
example, and the DocumentEditor example.  It works in the Anagrams, but not 
in DocumentEditor.

The error:

Code:

java.sql.SQLException: Io exception: The Network Adapter could not establish 
the connection




When packaged into the dist directory, Anagrams only contains ojdbc14.jar, 
while DocumentEditor has 3 others:

Code:

appframework-1.0.3.jar
swing-layout-1.0.4.jar
swing-worker-1.1.jar




I don't think swing-layout is relevant, because I've duplicated this problem 
with other code that didn't require that particular file.

Furthermore, both versions run on a different machine with the same version 
of java.  The problem is also the same whether I run the code from within 
NetBeans, or from the command line.

Versions: Netbeans 6.8 and the java version that it comes with.  Also on the 
machine is JRE 1.6.0_17.  A fully-patched Windows XP.

Since both routines work on a different machine, there's something 
'environmental' going on, I guess.  But can anyone shed any light on what 
accesses a java desktop application would be making that are not made by java 
application?

Thanks
-Mike.






[nbusers] Oracle connection failure, none for java app, yes for java desktop app

mikeh 03/31/2010

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close