论坛首页 Java企业应用论坛

[求助]访问数据库报错,不知道什么原因,请指点……

浏览 6151 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2003-12-30  
用的是tomcat和Sqlserver;
15:59:05,453  WARN SessionFactoryObjectFactory:101 - InitialContext did not implement EventContext
query = net.sf.hibernate.impl.QueryImpl@58dd2d
Hibernate: select course0_.CourseId as x0_0_ from Courses course0_ where (course0_.Name like ? );
Hibernate: select course0_.CourseId as CourseId0_, course0_.Name as Name0_ from Courses course0_ w
re course0_.CourseId=?
15:59:06,015  WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState: 08007
15:59:06,015 ERROR JDBCExceptionReporter:46 - [Microsoft][SQLServer JDBC Driver]Can't start a clon
 connection while in manual transaction mode.
15:59:06,015  WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState: 08007
15:59:06,015 ERROR JDBCExceptionReporter:46 - [Microsoft][SQLServer JDBC Driver]Can't start a clon
 connection while in manual transaction mode.
15:59:06,031 ERROR JDBCExceptionReporter:38 - could not load: [study.hibernate.Course#1]
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Can't start a cloned connection while in
nual transaction mode.
        at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source);
        at com.microsoft.jdbc.base.BaseConnection.getImplConnection(Unknown Source);
        at com.microsoft.jdbc.base.BaseStatement.getImplConnection(Unknown Source);
        at com.microsoft.jdbc.base.BaseStatement.getImplStatement(Unknown Source);
        at com.microsoft.jdbc.base.BaseStatement.preProcessSQL(Unknown Source);
        at com.microsoft.jdbc.base.BasePreparedStatement.<init>(Unknown Source);
        at com.microsoft.jdbc.base.BaseConnection.prepareStatement(Unknown Source);
        at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:233);
        at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:61);
        at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:699);
        at net.sf.hibernate.loader.Loader.doQuery(Loader.java:180);
        at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:128);
        at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:826);
        at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:846);
        at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:57);
        at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:49);
        at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:420);
        at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2042);
        at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1916);
        at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1878);
        at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:68);
        at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:215);
        at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:154);
        at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:71);
        at net.sf.hibernate.impl.IteratorImpl.<init>(IteratorImpl.java:48);
        at net.sf.hibernate.hql.QueryTranslator.iterate(QueryTranslator.java:843);
        at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1538);
        at net.sf.hibernate.impl.QueryImpl.iterate(QueryImpl.java:33);
        at study.hibernate.CourseBean.getSomeCourse(CourseBean.java:65);
        at org.apache.jsp.queryCourse$jsp._jspService(queryCourse$jsp.java:92);
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107);
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853);
        at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201);
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381);
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473);
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853);
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain
ava:247);
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:19

        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243);
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566);
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472);
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943);
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190);
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566);
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472);
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943);
        at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347);
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180);
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566);
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170);
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564);
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170);
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564);
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468);
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564);
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472);
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943);
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174);
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566);
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472);
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943);
        at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027);
        at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125);
        at java.lang.Thread.run(Thread.java:479);


不知道是什么地方没有配置好能还是什么其它原因!thx
   发表时间:2003-12-30  
db url中加上selectMode=cursor
0 请登录后投票
   发表时间:2003-12-31  
我加上试试好像还是不行,报错信息一样的,我把我的配置代码也贴上,劳烦你们看看
0 请登录后投票
   发表时间:2003-12-31  
hibernate.properties:

## MS SQL Server

hibernate.dialect net.sf.hibernate.dialect.SQLServerDialect
hibernate.connection.username sa
hibernate.connection.password 123456

## Microsoft Driver (not recommended!);
hibernate.connection.driver_class com.microsoft.jdbc.sqlserver.SQLServerDriver
hibernate.connection.url jdbc:microsoft:sqlserver://egov-server:1433;DatabaseName=test;SelectMethod=test


hibernate.cfg.xml:

<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
    <session-factory>
        <property name="connection.datasource">java:comp/env/jdbc/hibernate</property>
        <property name="show_sql">true</property>
        <property name="use_outer_join">false</property>
        <property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>
        <property name="connection.provider_class">net.sf.hibernate.connection.DatasourceConnectionProvider</property>
        <property name="session_factory_name">hibernate/session_factory</property>
        <property name="jdbc.batch_size">25</property>
        <property name="statement_cache.size">25</property>
        <property name="connection.pool_size">1</property>
        <property name="transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>
        <property name="jdbc.fetch_size">50</property>
        <property name="jdbc.batch_size">25</property>
        <property name="jdbc.use_streams_for_binary">true</property>
        <property name="max_fetch_depth">1</property>
        <property name="cache.provider_class">net.sf.hibernate.cache.HashtableCacheProvider</property>
        <!-- Mapping files -->
        <mapping resource="study/hibernate/Course.hbm.xml"/>

    </session-factory>

</hibernate-configuration>


不知道是否是因为我的配置文件写的有问题,还是什么,我实在看不出来了
0 请登录后投票
   发表时间:2003-12-31  
引用

SelectMethod=test

??
0 请登录后投票
   发表时间:2003-12-31  
先谢谢你的关注!
SelectMethod=×××我不太清楚这个有什么用?
另外我修改成你先前所说的selectMode=cursor,但好像问题依旧,现在搞的很郁闷。
0 请登录后投票
   发表时间:2003-12-31  
sorry,是SelectMethod=cursor
0 请登录后投票
   发表时间:2003-12-31  
OK!好了,原来是这个原因阿,再问一句SelectMethod=cursor
是什么意思,起什么作用的
0 请登录后投票
   发表时间:2004-01-06  
向数据库表中insert一条记录时候,tomcat报出一下信息,并insert没有成功,不知为何?
11:02:05,031  WARN SessionFactoryObjectFactory:101 - InitialContext did not implement EventContext
Hibernate: insert into Courses (Name, CourseId); values (?, ?);
11:02:05,468  WARN JDBCExceptionReporter:20 - SQL Warning: 0, SQLState: null
11:02:05,468  WARN JDBCExceptionReporter:28 - [Microsoft][SQLServer JDBC Driver]Database changed to
test
11:02:05,468  WARN JDBCExceptionReporter:20 - SQL Warning: 0, SQLState:
11:02:05,468  WARN JDBCExceptionReporter:28 - [Microsoft][SQLServer JDBC Driver][SQLServer]已将数据
库上下文改为 'test'。
11:02:05,484  WARN JDBCExceptionReporter:20 - SQL Warning: 0, SQLState: null
11:02:05,484  WARN JDBCExceptionReporter:28 - [Microsoft][SQLServer JDBC Driver]Language changed to
简体中文
11:02:05,484  WARN JDBCExceptionReporter:20 - SQL Warning: 0, SQLState:
11:02:05,484  WARN JDBCExceptionReporter:28 - [Microsoft][SQLServer JDBC Driver][SQLServer]已将语言
设置改为 简体中文。



这几个warn是什么意思呢?
请指教。thx!
0 请登录后投票
   发表时间:2004-01-06  
noboby? 顶!
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics