H
happyprg
Unregistered / Unconfirmed
GUEST, unregistred user!
我要用applet 访问数据库,请帮我看一下,Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver")不能执行,请教原因.是否需要通过socket 访问数据库 ,在application 不在applet里写就没问题,实在搞不明白,是安全原因吗?
import java.applet.*;
import java.net.URL;
import java.sql.*;
import java.awt.*;
import java.util.*;
public class Trendnew extends Applet{
boolean judge;
public void init()
{
resize(400,300);
// String url = "jdbcdbc:test";
try //异常处理模块
{
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
// Connection con = DriverManager.getConnection (
// url, "", "");
judge=true;
}
catch(java.lang.Exception ex)
{
judge=false;
}
}
public void paint(Graphics g)
{
if (judge==true)
{
g.drawString("ttttttttt",40,40);
}
else
{
g.drawString("ffffffff",60,40);
}
}
}
import java.applet.*;
import java.net.URL;
import java.sql.*;
import java.awt.*;
import java.util.*;
public class Trendnew extends Applet{
boolean judge;
public void init()
{
resize(400,300);
// String url = "jdbcdbc:test";
try //异常处理模块
{
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
// Connection con = DriverManager.getConnection (
// url, "", "");
judge=true;
}
catch(java.lang.Exception ex)
{
judge=false;
}
}
public void paint(Graphics g)
{
if (judge==true)
{
g.drawString("ttttttttt",40,40);
}
else
{
g.drawString("ffffffff",60,40);
}
}
}