导航
  • 主页
  • 基础类
  • 应用实例
  • 新技术前沿

出现这样的错误怎么解决?

dolphinj 2003-01-04 04:39:40
java.lang.NoSuchFieldError: transliterator

at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processColMetaData(Unknown Source)

at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)

at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)

at com.microsoft.jdbc.sqlserver.tds.TDSCursorRequest.openCursor(Unknown Source)

at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute(Unknown Source)

at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)

at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source)

at com.microsoft.jdbc.base.BaseStatement.executeQuery(Unknown Source)

at sks.ConnBean.executeQuery(ConnBean.java:48)

at sks.ConnBean.main(ConnBean.java:81)

Exception in thread "main"

源程序为
package sks;
import java.io.PrintStream;
import java.sql.*;


public class ConnBean
{

public ConnBean()
{
sDBDrive = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
sDBSource = "jdbc:microsoft:sqlserver://Administrator;DatabaseName=sks;User=sa";
conn = null;
stmt = null;
rs = null;
try
{
Class.forName(sDBDrive);
}
catch(ClassNotFoundException classnotfoundexception)
{
System.err.println("ConnBean():".concat(String.valueOf(String.valueOf(classnotfoundexception.getMessage()))));
}
try
{
conn = DriverManager.getConnection(sDBSource);
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
}
catch(SQLException sqlexception)
{
System.err.println("ConnBean():".concat(String.valueOf(String.valueOf(sqlexception.getMessage()))));
}
}

public ResultSet executeQuery(String s)
{
rs = null;
try
{
rs = stmt.executeQuery(s);
}
catch(SQLException sqlexception)
{
System.err.println("executeQuery:".concat(String.valueOf(String.valueOf(sqlexception.getMessage()))));
}
return rs;
}

public void executeUpdate(String s)
{
try
{
stmt.executeUpdate(s);
}
catch(SQLException sqlexception)
{
System.err.println("executeUpdate:".concat(String.valueOf(String.valueOf(sqlexception.getMessage()))));
}
}

String sDBDrive;
String sDBSource;
Connection conn;
Statement stmt;
ResultSet rs;
public static void main(String[] args)throws Exception {
try
{
String sql;
ResultSet rs;
sql="select * from Department";
ConnBean conn=new ConnBean();
rs=conn.executeQuery(sql);
while(rs.next())
{
System.out.print(rs.getString(1));
}
}catch(Exception e){
System.out.print(e.getMessage());
}
}
}
...全文
29 点赞 收藏 回复
写回复
回复
切换为时间正序
请发表友善的回复…
发表回复

还没有回复,快来抢沙发~

发动态
发帖子
MS-SQL Server
创建于2007-09-28

3.2w+

社区成员

MS-SQL Server相关内容讨论专区
申请成为版主
社区公告
暂无公告