weblogic8.1+sqlserver2005
获得数据源之后,可以获得连接,但是执行这句就报错:ps = conn.prepareStatement(sql);
大虾帮忙看看啊,在线等,
另外问个问题,我以前的是sqlserver2000,现在配置2005的数据连接,程序会出错吗,改动会不会很大?
conn:weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_com_microsoft_sqlserver_jdbc_SQLServerConnection_816_WLStub@1
java.sql.SQLException: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.sql.PreparedStatement
at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:209)
at com.test.util.Test.main(Test.java:51)这是测试代码Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
ctx = new InitialContext(ht);
DataSource ds = (DataSource) ctx.lookup("GuanRiDS");
Connection conn = ds.getConnection();
System.out.println("conn:" + conn);
PreparedStatement ps = null;
ResultSet rs = null;
String sql = "select * from gr_v_user_name where status=0 and dept_id !=-1 and acc_name='ghwang'";
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
if (rs.next()) {
System.out.println(rs.getString("acc_pwd"));
System.out.println(rs.getString("emp_no"));
}
获得数据源之后,可以获得连接,但是执行这句就报错:ps = conn.prepareStatement(sql);
大虾帮忙看看啊,在线等,
另外问个问题,我以前的是sqlserver2000,现在配置2005的数据连接,程序会出错吗,改动会不会很大?
conn:weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_com_microsoft_sqlserver_jdbc_SQLServerConnection_816_WLStub@1
java.sql.SQLException: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.sql.PreparedStatement
at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:209)
at com.test.util.Test.main(Test.java:51)这是测试代码Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
ctx = new InitialContext(ht);
DataSource ds = (DataSource) ctx.lookup("GuanRiDS");
Connection conn = ds.getConnection();
System.out.println("conn:" + conn);
PreparedStatement ps = null;
ResultSet rs = null;
String sql = "select * from gr_v_user_name where status=0 and dept_id !=-1 and acc_name='ghwang'";
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
if (rs.next()) {
System.out.println(rs.getString("acc_pwd"));
System.out.println(rs.getString("emp_no"));
}
解决方案 »
- 请问一个关于数据库设计文档的问题
- |zyciis| 麻烦大家帮我分析一下,这两个对表的锁定是不是相同 谢谢 急
- SqlServer2005如何同SqlServer2005的Analysis Services结合起来?
- 请教
- 行列转换问题!!!
- 有没有sql游标学习的教程?
- 棘手的多表统计问题
- sql server2k 可以设置成大小写敏感吗?
- 我怎么整合这几个sql语句!
- 我在vb中能使用所有sql server中的查询吗?
- 还原数据库时提示“发生内部一致性错误。请与技术支持联系以寻求协助。”
- 事务复制,代理总不错unable to read local eventlog(reason:参数不正确)
报什么错?---------------------------------------
爱问易 - 非官方技术支持互助平台
http://www.iaskengineer.com
---------------------------------------