Database-connect within a JAR 
Author Message
 Database-connect within a JAR

Hello all,

I have a probem with connecting to an database in the case, that
my applet-class is packed in a JAR-archive. The same source-code,
not in a JAR-file, is running with no problems. But as I am putting
it into a JAR-archive, I am getting a message in the Netscape Java
Console, which look like this:

_________________________________________________________________________________________________
Netscape Communications Corporation -- Java 1.1.5
Type '?' for options.
Symantec Java! ByteCode Compiler Version 210.065
Copyright (C) 1996-97 Symantec Corporation
1
2
Hallo_2
netscape.security.AppletSecurityException: security.Couldn't connect to 'NTSV03' with origin from ''.
  at java.lang.Throwable.<init>(Compiled Code)
  at java.lang.Exception.<init>(Compiled Code)
  at java.lang.RuntimeException.<init>(Compiled Code)
  at java.lang.SecurityException.<init>(Compiled Code)
  at netscape.security.AppletSecurityException.<init>(Compiled Code)
  at netscape.security.AppletSecurityException.<init>(Compiled Code)
  at netscape.security.AppletSecurity.checkConnect(Compiled Code)
  at netscape.security.AppletSecurity.checkConnect(Compiled Code)
  at netscape.security.AppletSecurity.checkConnect(Compiled Code)
  at java.lang.SecurityManager.checkConnect(Compiled Code)
  at java.net.InetAddress.getAllByName0(Compiled Code)
  at java.net.InetAddress.getByName(Compiled Code)
  at java.net.Socket.<init>(Compiled Code)
  at oracle.sqlnet.SQLnet.Connect(Compiled Code)
  at oracle.sqlnet.SQLnet.Connect(Compiled Code)
  at oracle.sqlnet.SQLnet.Connect(Compiled Code)
  at oracle.jdbc.ttc7.TTC7Protocol.connect(Compiled Code)
  at oracle.jdbc.ttc7.TTC7Protocol.logon(Compiled Code)
  at oracle.jdbc.driver.OracleConnection.<init>(Compiled Code)
  at oracle.jdbc.driver.OracleDriver.connect(Compiled Code)
  at java.sql.DriverManager.getConnection(Compiled Code)
* at java.sql.DriverManager.getConnection(Compiled Code)
  at Haupt_applet.init(Compiled Code)
  at netscape.applet.DerivedAppletFrame$InitAppletEvent.dispatch(Compiled Code)
  at java.awt.EventDispatchThread$EventPump.dispatchEvents(Compiled Code)
  at java.awt.EventDispatchThread.run(Compiled Code)
  at netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(Compiled Code)
_________________________________________________________________________________________

The source-code of the applet look like this:

import java.applet.*;
import java.sql.*;
import java.awt.*;
import netscape.security.PrivilegeManager;

public class Haupt_applet extends Applet {

        public void init()
        {
            Connection con_to;
                Connection con_from;

                setLayout(null);
                setSize(232,172);
                setBackground(new Color(12632256));

        //      StDtVerwaltung StDtVerw = new StDtVerwaltung();

                try {
                    PrivilegeManager.enablePrivilege("UniversalConnect");

                    System.out.println("1");

                    DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver ());

                    System.out.println("2");

est");

est");

                    con_to.setAutoCommit(false);

                    System.out.println("3");

        //          StDtVerw.Datenbank_anlegen(con_to);

                    System.out.println("4");

                    con_from.close();
                    con_to.close();
                    }

                    catch (netscape.security.ForbiddenTargetException e) {
                        System.out.println("Hello_1");
                    }

                    catch (java.lang.Exception ex) {
                        System.out.println("Hallo_2");
                        ex.printStackTrace();
                    }
        }

Quote:
}

_________________________________________________________________________________________________

As you are able to see, I am using der Capability-class from Netscape, to get the
UniversalConnect-Privilege, which let me connect to the database server. But only, if I am not
putting my Applet in a JAR-archive!! And this is the problem.

I would be very glad, if you could help me please or if you could show me some place in WWW, where
I get help on this.

Waiting for your answer,

                Uebber

--

------------------------------------------------------------
Dirk Uebber                         phone: +49 7031 873 534
Sindelfingen                        fax  : +49 7031 873 535


------------------------------------------------------------



Mon, 18 Dec 2000 03:00:00 GMT
 
 [ 1 post ] 

 Relevant Pages 

1. Connect to Oracle database from within VB

2. Using user's oracle credentials to connect to database within BMP

3. Database applet and signed jar

4. Can't connect to SQLServer using a dataSource within a Session bean

5. Possible to connect to ODBC within TSQL?

6. connecting to linked server from within trigger

7. connecting within a workgroup

8. Error connecting to SQL Server 7.0 from within a class

9. Connecting from within VCPP in debug mode

10. Connect remote db within PL/SQL

11. Connect/Disconnect db within procedure


 
Powered by phpBB® Forum Software