Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

SecurityException when running applet in IE5

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following applet will not run in the browser. Viewing the java console shows:
"com.ms.security.SecurityExceptionEx[administrator/Patient.HentOverskrift]: java.io.IOException: bad path: C:\JBuilder3\myclasses\sun\jdbc\odbc\JdbcOdbcDriver.class
..."
How do I solve this problem?
Here is part of the applet:
package administrator;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.sql.*;
public class Patient extends Applet {
boolean isStandalone = false;
int antal = 10, t;
int[] Indlaegsnr = new int[antal];
Label[] Tekst = new Label[antal];
Button[] Knap = new Button[antal];
int y = 0;
Panel panel1 = new Panel();
Panel panel2 = new Panel();
Panel panel3 = new Panel();
GridLayout gridLayout3 = new GridLayout(10,1,0,15);
GridLayout gridLayout4 = new GridLayout(10,1,0,15);
BorderLayout borderLayout1 = new BorderLayout(15,15);
BorderLayout borderLayout2 = new BorderLayout();

//Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
//Construct the applet
public Patient() {
}
//Initialize the applet
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
this.setBackground(Color.white);
this.setSize(new Dimension(500, 377));
this.setLayout(borderLayout2);
panel1.setBackground(Color.white);
panel1.setLayout(borderLayout1);
panel2.setLayout(gridLayout3);
panel3.setLayout(gridLayout4);
panel2.setBackground(Color.white);
panel3.setBackground(Color.white);
t=0;
this.add(panel1, BorderLayout.CENTER);
panel1.add(panel2, BorderLayout.WEST);
panel1.add(panel3, BorderLayout.CENTER);
for(int i=0; i<antal;i++) {
Tekst[i] = new Label();
Knap[i] = new Button();
Knap[i].setLabel(" ");
Knap[i].setBackground(new java.awt.Color(185, 225, 255));
Knap[i].addActionListener(new java.awt.event.ActionListener() {
String knapnr = String.valueOf(t);
public void actionPerformed(ActionEvent e) {
Knap_actionPerformed(e, knapnr);
}
});
t+=1;
}
// int knapantal = 3;
int knapantal = HentOverskrift();
if (knapantal!= 0) {
for(int a=0; a<knapantal;a++) {
panel2.add(Knap[a], null);
panel3.add(Tekst[a], null);
}
}
else {
Tekst[0].setText("Der er intet indl�g under dette emne.");
}
}
//Start the applet
public void start() {
}
//Stop the applet
public void stop() {
}
//Destroy the applet
public void destroy() {
}
//Get Applet information
public String getAppletInfo() {
return "Applet Information";
}
//Get parameter info
public String[][] getParameterInfo() {
return null;
}
public int HentOverskrift(){
Connection con;
Statement stmt;
ResultSet svar;
int nr = 0;
String minodbc = ("jdbc:odbc:ventev");
String minquery = ("SELECT overskrift, o_id FROM oversigt WHERE E_id = 'Pat_H' ORDER BY o_id DESC");
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e) {
System.out.println("Kan ikke finde driveren");
}
try {
// etablerer forbindelse til den angivne (JDBC-ODBC-bridgen)
con = DriverManager.getConnection(minodbc,"dba","sql");
stmt = con.createStatement(); // Opretter et SQL-udtryk og afleverer et objekt
svar = stmt.executeQuery(minquery); // Executes a query.
while(svar.next()) {
Indlaegsnr[nr] = svar.getInt("o_id");
Tekst[nr].setText(svar.getString("overskrift"));
nr++;
}
stmt.close();
con.close();
}
catch(SQLException e ) {
System.out.println("SQL fejl 1: " + e.getMessage());
}
return nr;
}
}
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you ever solve the problem? I am in a similiar situation, with my swing components in my applet.

Originally posted by Merete Lorenzen:
The following applet will not run in the browser. Viewing the java console shows:
"com.ms.security.SecurityExceptionEx[administrator/Patient.HentOverskrift]: java.io.IOException: bad path: C:\JBuilder3\myclasses\sun\jdbc\odbc\JdbcOdbcDriver.class
..."
How do I solve this problem?
Here is part of the applet:
package administrator;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.sql.*;
public class Patient extends Applet {
boolean isStandalone = false;
int antal = 10, t;
int[] Indlaegsnr = new int[antal];
Label[] Tekst = new Label[antal];
Button[] Knap = new Button[antal];
int y = 0;
Panel panel1 = new Panel();
Panel panel2 = new Panel();
Panel panel3 = new Panel();
GridLayout gridLayout3 = new GridLayout(10,1,0,15);
GridLayout gridLayout4 = new GridLayout(10,1,0,15);
BorderLayout borderLayout1 = new BorderLayout(15,15);
BorderLayout borderLayout2 = new BorderLayout();

//Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
//Construct the applet
public Patient() {
}
//Initialize the applet
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
this.setBackground(Color.white);
this.setSize(new Dimension(500, 377));
this.setLayout(borderLayout2);
panel1.setBackground(Color.white);
panel1.setLayout(borderLayout1);
panel2.setLayout(gridLayout3);
panel3.setLayout(gridLayout4);
panel2.setBackground(Color.white);
panel3.setBackground(Color.white);
t=0;
this.add(panel1, BorderLayout.CENTER);
panel1.add(panel2, BorderLayout.WEST);
panel1.add(panel3, BorderLayout.CENTER);
for(int i=0; i<antal;i++) {
Tekst[i] = new Label();
Knap[i] = new Button();
Knap[i].setLabel(" ");
Knap[i].setBackground(new java.awt.Color(185, 225, 255));
Knap[i].addActionListener(new java.awt.event.ActionListener() {
String knapnr = String.valueOf(t);
public void actionPerformed(ActionEvent e) {
Knap_actionPerformed(e, knapnr);
}
});
t+=1;
}
// int knapantal = 3;
int knapantal = HentOverskrift();
if (knapantal!= 0) {
for(int a=0; a<knapantal;a++) {
panel2.add(Knap[a], null);
panel3.add(Tekst[a], null);
}
}
else {
Tekst[0].setText("Der er intet indl�g under dette emne.");
}
}
//Start the applet
public void start() {
}
//Stop the applet
public void stop() {
}
//Destroy the applet
public void destroy() {
}
//Get Applet information
public String getAppletInfo() {
return "Applet Information";
}
//Get parameter info
public String[][] getParameterInfo() {
return null;
}
public int HentOverskrift(){
Connection con;
Statement stmt;
ResultSet svar;
int nr = 0;
String minodbc = ("jdbc dbc:ventev");
String minquery = ("SELECT overskrift, o_id FROM oversigt WHERE E_id = 'Pat_H' ORDER BY o_id DESC");
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e) {
System.out.println("Kan ikke finde driveren");
}
try {
// etablerer forbindelse til den angivne (JDBC-ODBC-bridgen)
con = DriverManager.getConnection(minodbc,"dba","sql");
stmt = con.createStatement(); // Opretter et SQL-udtryk og afleverer et objekt
svar = stmt.executeQuery(minquery); // Executes a query.
while(svar.next()) {
Indlaegsnr[nr] = svar.getInt("o_id");
Tekst[nr].setText(svar.getString("overskrift"));
nr++;
}
stmt.close();
con.close();
}
catch(SQLException e ) {
System.out.println("SQL fejl 1: " + e.getMessage());
}
return nr;
}
}


 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic