我使用hibernate连接sqlserver2000时总是提示Source not found for TDSRPCRequest(TDSRequest).processReply(BaseWarnings) line: not available这个错误,改了很多地方都没有解决。请帮忙解决下。在我使用mysql时没有错误,即修改server的hibernate配置文件后mysql即可使用server的配置文件hibernate.cfg.xml 为:<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration> <session-factory>
<property name="connection.username">sa</property>
<property name="connection.url">
jdbc:sqlserver://localhost:1433;DatabaseName=tt
</property>
<property name="dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<property name="myeclipse.connection.profile">myConn</property>
<property name="connection.password">0</property>
<property name="connection.driver_class">
com.microsoft.jdbc.sqlserver.SQLServerDriver
</property>
<mapping resource="cn/com/tym/User.hbm.xml" /> </session-factory>
</hibernate-configuration>调用java为:public class TestA extends HttpServlet { protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
String name = request.getParameter("name");
response.setContentType("text/xml; charset=UTF-8");
response.setHeader("Cache-Control", "no-cache");
PrintWriter out = response.getWriter();
Session session = SessionFactory.currentSession();
Query query = session
.createQuery("from User as u where u.name=:username");
query.setString("username", name);
List list = query.list();//经多次验证,到这里list、或调用save时都会错误*************
System.out.println("ccc:" + list.size());
out.println("<pront>");
if (list.size() != 0) {
out.println("<content>" + "aaa!" + "</content>");
} else {
out.println("<content>" + "bbb!" + "</content>");
}
out.println("</pront>");
out.close(); }
}并且还有这样的警告提示:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.我只有可怜的10分,^_^,谢谢帮忙了
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration> <session-factory>
<property name="connection.username">sa</property>
<property name="connection.url">
jdbc:sqlserver://localhost:1433;DatabaseName=tt
</property>
<property name="dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<property name="myeclipse.connection.profile">myConn</property>
<property name="connection.password">0</property>
<property name="connection.driver_class">
com.microsoft.jdbc.sqlserver.SQLServerDriver
</property>
<mapping resource="cn/com/tym/User.hbm.xml" /> </session-factory>
</hibernate-configuration>调用java为:public class TestA extends HttpServlet { protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
String name = request.getParameter("name");
response.setContentType("text/xml; charset=UTF-8");
response.setHeader("Cache-Control", "no-cache");
PrintWriter out = response.getWriter();
Session session = SessionFactory.currentSession();
Query query = session
.createQuery("from User as u where u.name=:username");
query.setString("username", name);
List list = query.list();//经多次验证,到这里list、或调用save时都会错误*************
System.out.println("ccc:" + list.size());
out.println("<pront>");
if (list.size() != 0) {
out.println("<content>" + "aaa!" + "</content>");
} else {
out.println("<content>" + "bbb!" + "</content>");
}
out.println("</pront>");
out.close(); }
}并且还有这样的警告提示:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.我只有可怜的10分,^_^,谢谢帮忙了
解决方案 »
- hibernate只有两个字段,一个是自增一个是普通字段,删后的问题。
- JNDI 在 J2EE 中的角色
- 按J2EE Tutorial里说的例子写的,可是WEB客户端运行出错!
- 刚毕业的学生想问下看到我提问问题的老总的一些问题
- 工程里面出现了无限循环路径!!!
- 关注Struts 1.2.1新特点,希望与大家共同讨论!
- 请问如何实现一个定时下载以及上传的程序?
- 从J2EE程序员转为做系统分析,从何入手,大家给点意见..UP者有分
- 银联卡问题
- 两个问题(有关用Jbuiler7+weblogic7开发CMP)(100分)
- 工作一年在上海能拿多少工资,Java开发
- struts1 action提交转到页面 刷新后又退回到之前的action
<%@ page import="java.lang.*, java.io.*, java.sql.*,
java.util.*" contentType="text/html;charset=gb2312" %>
<html>
<body>
<%
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=tt";
//pubs 为你的数据库的
String user="sa";
String password="0"; //此处的密码可以更改, 在企业管理器中,找到 “安全性”--点击“登录”--右击 sa 选择“属性”--在里面对密码进行更改
Connection conn=
DriverManager.getConnection(url,user,password);
Statement
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from useraaa";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) { %>
您的第一个字段内容为:<%=rs.getString(1)%><br>
您的第二个字段内容为:<%=rs.getString(2)%><br>
<% } %>
<% out.print("数据库操作成功,恭喜你"); %>
<% rs.close();
stmt.close();
conn.close();
%>
</body>
</html> 如果上面能连得通,肯定就是Hibernate得配置问题了。