Applet trying to connect to Oracle DB
Hello!
I am trying to access an Oracle 8i database from an Applet. The problem is that the following exception is reported in IE 5.5
and the Applet is not run.
exception: com.ms.security.SecurityEceptionEx[oracle/net/nt/TcpNTAdpater.connect]:cannot access "pc38"
(where my database is being hosted on the intranet at a NT workstation called pc38). The applet does not seem to be able to connect to the datase due to security reason).
In Netscape no exception is shown in the Java Console but the Applet is not run anyway.
What do I have to do for the Applet to be able to connect to the database. The code for the Applet and the HTML file have been appended to this message.
Thanx in advance
Saad
/*********************************Applet*******************************/
String serviceName="ora816";
String hostName="pc38";
String userName="ipweb355";
String password="ipweb355";
String port="1521";
Connection conn=null;
try
{
java.sql.DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
String url = "jdbc:oracle:thin:@"+this.hostName+":"+this.port+":"+this.serviceName;
System.out.println("url = "+url+ " UserName = "+this.userName+ " password = "+this.password+" port = "+this.port );
conn = java.sql.DriverManager.getConnection(url, this.userName, this.password);
}
public void paint(Graphics g){
g.drawString("HI there",20,20);
try{
Connection con = conn;
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("Select COUNT(*) AS NUM_ROWS from TABLE_ONE");
rs.next();
String temp = rs.getString("NUM_ROWS");
g.drawString(temp,100,20);
}
catch(SQLException e){
g.drawString(e.getMessage(),20,20);
}
/*********************************************************************/
/********************HTML*********************************************/
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<TITLE>
HTML Test Page
</TITLE>
</HEAD>
<BODY>
testApplet will appear below in a Java enabled browser.
<APPLET
CODEBASE = "D:\IPWeb\Swings\TreeApplet\src"
ARCHIVE = "classes111.zip"
CODE= "testApplet.class"
NAME= "TestApplet"
WIDTH= 400
HEIGHT= 300
HSPACE= 0
VSPACE= 0
ALIGN= middle
>
</APPLET>
</BODY>
</HTML>
<!--the classes111.zip is being send in the Archive file so that the java.lang.ClassNotFound Exception is not reported-->
/*********************************************************************/

