• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

connecting to a database using Applets

 
Cool Impression
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am using Applet while creating a database connection I get
RuntimePermissionException "Access is denied"
while same code is running in windows 2000, and on Some Systems it runs.
Code is very simple. but I am getting Exception.
The code is:
import java.applet.*;
import java.sql.*;
public class testapp extends Applet{
static Connection cn;
static Statement st;
static ResultSet rs;
public void init()
{
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc dbc:testdsn");
st=cn.createStatement();
rs=st.executeQuery("select * from tablename");
rs.next();
System.out.println(rs.getString(1)+":"rs.getString(2));
}catch(Exception e){System.out.println(e);}
}
}
This is the code and I am getting the Exception on the line
Class.forName()..
What is this Error, and How this Exception can be solved Please
guide me about that.
It's Urgent.....
Thank You..;

------------------
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic