AccessDB.JAVA文件代码: import java.awt.*;
import java.applet.*;
public class AccessDB extends Applet
{
TextField theStatus=new TextField();
public void init()
{
add(theStatus);
theStatus.setEditable (false);
openConnection();
}
public void openConnection()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
theStatus.setText("OK");
}
catch (Exception e)
{
theStatus.setText("FALSE");
}
}
}
html文件代码:
<html>
<head>
<title>AccessDB </title>
</head>
<body>
<applet code=AccessDB.class width=1000 height=400 > </applet>
</body>
</html>
运行后,为什么一直在文本框中显示FALSE,哪里出错了?
import java.applet.*;
public class AccessDB extends Applet
{
TextField theStatus=new TextField();
public void init()
{
add(theStatus);
theStatus.setEditable (false);
openConnection();
}
public void openConnection()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
theStatus.setText("OK");
}
catch (Exception e)
{
theStatus.setText("FALSE");
}
}
}
html文件代码:
<html>
<head>
<title>AccessDB </title>
</head>
<body>
<applet code=AccessDB.class width=1000 height=400 > </applet>
</body>
</html>
运行后,为什么一直在文本框中显示FALSE,哪里出错了?
是不是没引入驱动包~