SOS!关于Applet连接ms sql server

xpdonkey 2001-08-21 09:52:26
最近这两天开始用JAVA做个小东西,是我门的项目的一部分,任务就是通过浏览器访问我们的数据库,考虑到其他因素,不能用JDBC-ODBC bridge,用Applet应该够简单了,可是怎么也连不上数据库,问了一些人,也没结果:
applet没有存取本地起源,好象完全符合jvm对applet的限制
Server OS:windows2000 Server
server name:software;server IP:10.9.100.29
DataBase platform:Ms Sql Server7 standard (port: default:1433)
Sql server group:SOFTWARE
database name:manage
IIS:Windows2000 内置
Client windows2000 Professial+IE+Netscape6
JKD1.1.8
JDBC driver:weblogic or com.inet.tds.TdsDriver:Type 4
Sql Server 和IIS装在同一服务器上Sql server 设为Window NT认证和Sqlk Server认证
先做连接数据库实验,用以下代码通过AppletViewer通过,用browser抛出安全异常com.ms.secrity.secrityExceptionEx(Host):can not access "software"
在连接中换成IP连接(Connection connection=DriverManager.getConnection("jdbc:inetdae7:software","111","111");):则浏览器提示ACTiveX不安全,可能无法显示,也没显示结果
给点建议
thank you in advance



import java.sql.*;
import java.applet.*;
import java.awt.Graphics;
public class logDB extends Applet
{
String url = "jdbc:inetdae7:software:1433";
String login = "111";
String password = "111";
public void init()
{
try
{
Class.forName("com.inet.tds.TdsDriver").newInstance();
Connection connection=DriverManager.getConnection("jdbc:inetdae7:software","111","111");
connection.close();
message="OK,connect ok";
}

catch(ClassNotFoundException ex)
{
message = "Exception1: Driver wasn't found, check classpath: " + ex;
}

catch(Exception ex)
{
message = "Exception while opening the connection2: " + ex;
ex.printStackTrace(System.out);
}

catch(Error err)
{
message = "Error while opening the connection:3 " + err;
err.printStackTrace(System.out);
}
System.out.println(message);
repaint();
}
public void paint(Graphics graphics)
{
graphics.drawString(message,0,20);
}
String message = "";
}




...全文
31 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

34,575

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧