我在websphere5.0中配置一个sql server 2000的数据源,配置后,执行getConnetion方法抛出如下错误:不知何故,请各位sphere大侠告之!小弟感激。
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]未能找到存储过程 'master..xp_jdbc_open'。
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(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.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
at com.microsoft.jdbcx.sqlserver.SQLServerImplXAResource.executeXaRpc(Unknown Source)
at com.microsoft.jdbcx.sqlserver.SQLServerImplXAResource.executeXaRpc(Unknown Source)
你的SqlServer和WAS是在一台机器吗?
你选用的是什么Driver?
SqlServer的版本?
是否添加了必要的参数,比如数据库名,服务器名,端口号,用户名,密码?
给你段JSP的代码,我在WAS5里面测试过,可以连通SqlServer的数据源。
DataSource dataSource = null;
Connection con = null;
PreparedStatement state = null;
ResultSet rs = null;
java.util.Date date = new java.util.Date(0);
InitialContext ic = null;
try
{
ic = new InitialContext();
dataSource = (DataSource)ic.lookup("ECSN/DS/hq");
con = dataSource.getConnection();
state = con.prepareStatement("select Max(OpenDate), Max(CloseDate), Max(ModifyDate) from StockInfo");
rs = state.executeQuery();//Happen Exception here
while(rs.next())
{
out.println(rs.getTimestamp(1),rs.getTimestamp(2),rs.getTimestamp(3))
java.util.Date stockInfoDate = (java.util.Date)rs.getTimestamp(1);
if(stockInfoDate != null && stockInfoDate.after(date))
date = stockInfoDate;
stockInfoDate = (java.util.Date)rs.getTimestamp(2);
if(stockInfoDate != null && stockInfoDate.after(date))
date = stockInfoDate;
stockInfoDate = (java.util.Date)rs.getTimestamp(3);
if(stockInfoDate != null && stockInfoDate.after(date))
date = stockInfoDate;
}
}
catch(SQLException e)
{
out.println("数据库操作错误!" + e.toString());
}
finally
{
try
{
if(rs != null)
rs.close();
if(state != null)
state.close();
if(con != null)
con.close();
}
catch(SQLException e)
{}
}
-->
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8638427/viewspace-889889/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/8638427/viewspace-889889/