Java开发网 |
注册 |
登录 |
帮助 |
搜索 |
排行榜 |
发帖统计
|
您没有登录 |
» Java开发网 » Java EE 综合讨论区
» Hibernate
打印话题 寄给朋友 订阅主题 |
作者 | 向大哥们求救hibernate连接informix数据库的问题 |
hanry_mary
发贴: 4 积分: 0 |
于 2006-05-28 20:15
我用hibernate连接informix数据库,一个数据库环境在34.0.191.2:6666/rmsdb上,一个在34.0.50.182:1888/smisdb,web端代码相同,但由于要连接不同的数据库,所以部署成了两个web应用,hibernate的配置文件也相同,只是连接的数据库不同,我在jsp中测试Connnection dbOper = DriverManager.getConnection("jdbc:informix-sqli://34.0.191.2:6666/rmsdb:informixserver=test", "user","pass");和dbOper = DriverManager.getConnection("jdbc:informix-sqli://34.0.50.188:1888/smisdb:informixserver=特test1", "user1","pass1");都是连接成功的,但用hibernate连接34.0.191.2:6666/rmsdb却是不成功的,用hibernate连接34.0.50.182:1888/smisdb又是成功的,为什么会这样。配置文件为: <property name="hibernate.connection.driver_class">com.informix.jdbc.IfxDriver</property> <property name="hibernate.connection.url">jdbc:informix-sqli://34.0.191.2:6666/rmsdb:informixserver=test</property> <property name="hibernate.connection.username">user</property> <property name="hibernate.connection.password">pass</property> <property name="hibernate.dialect">org.hibernate.dialect.InformixDialect</property> <property name="hibernate.connection.pool_size">20</property> <property name="hibernate.connection.autocommit">false</property> <property name="hibernate.show_sql">false</property> 连接182机器的url不同,当能连接成功。 连接34.0.191.2这个机器的数据库时报错信息如下: 2006-05-28 19:56:02,093 INFO [net.sf.hibernate.connection.DriverManagerConnectionProvider] - <using driver: com.informix.jdbc.IfxDriver at URL: jdbc:informix-sqli://34.0.191.2:6666/rmsdb:informixserver=test> 2006-05-28 19:56:02,093 INFO [net.sf.hibernate.connection.DriverManagerConnectionProvider] - <connection properties: {user=rms, password=rms, autocommit=false}> 2006-05-28 19:56:02,109 INFO [net.sf.hibernate.transaction.TransactionManagerLookupFactory] - <No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)> 2006-05-28 19:56:02,375 WARN [net.sf.hibernate.cfg.SettingsFactory] - <Could not obtain connection metadata> java.sql.SQLException: 不支持事务 at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:373) at com.informix.jdbc.IfxSqliConnect.setAutoCommit(IfxSqliConnect.java:1812) at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:103) at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72) at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1132) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:766) at com.adtec.moia.dao.hibernate.HibernateSessionHelper.<clinit>(HibernateSessionHelper.java:28) at com.adtec.moia.dao.hibernate.HibernateProxyImpl.<init>(HibernateProxyImpl.java:35) at com.adtec.moia.dao.hibernate.UserDaoHibernate.<init>(UserDaoHibernate.java:34) at com.adtec.moia.dao.hibernate.DaoFactory.getUserDao(DaoFactory.java:34) at com.adtec.moia.web.LogonAction.execute(LogonAction.java:51) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.adtec.moia.filter.HibernateSessionFilter.doFilter(HibernateSessionFilter.java:43) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.adtec.moia.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:62) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.adtec.moia.filter.LoggerFilter.doFilter(LoggerFilter.java:109) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.adtec.moia.filter.PermissionFilter.doFilter(PermissionFilter.java:77) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6724) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178) 2006-05-28 19:56:02,390 INFO [net.sf.hibernate.cfg.SettingsFactory] - <Use scrollable result sets: false> 2006-05-28 19:56:02,390 INFO [net.sf.hibernate.cfg.SettingsFactory] - <Use JDBC3 getGeneratedKeys(): false> 2006-05-28 19:56:02,390 INFO [net.sf.hibernate.cfg.SettingsFactory] - <Optimize cache for minimal puts: false> 2006-05-28 19:56:02,390 INFO [net.sf.hibernate.cfg.SettingsFactory] - <Query language substitutions: {}> 2006-05-28 19:56:02,390 INFO [net.sf.hibernate.cfg.SettingsFactory] - <cache provider: net.sf.ehcache.hibernate.Provider> 2006-05-28 19:56:02,437 INFO [net.sf.hibernate.cfg.Configuration] - <instantiating and configuring caches> 2006-05-28 19:56:02,500 INFO [net.sf.hibernate.impl.SessionFactoryImpl] - <building session factory> 2006-05-28 19:56:03,796 INFO [net.sf.hibernate.impl.SessionFactoryObjectFactory] - <Factory name: moia> 2006-05-28 19:56:03,812 INFO [net.sf.hibernate.util.NamingHelper] - <JNDI InitialContext properties:{}> 2006-05-28 19:56:03,906 INFO [net.sf.hibernate.impl.SessionFactoryObjectFactory] - <Bound factory to JNDI name: moia> 2006-05-28 19:56:03,906 WARN [net.sf.hibernate.impl.SessionFactoryObjectFactory] - <InitialContext did not implement EventContext> 2006-05-28 19:56:04,265 WARN [net.sf.hibernate.util.JDBCExceptionReporter] - <SQL Error: -79744, SQLState: IX000> 2006-05-28 19:56:04,265 ERROR [net.sf.hibernate.util.JDBCExceptionReporter] - <不支持事务> 2006-05-28 19:56:04,265 ERROR [net.sf.hibernate.util.JDBCExceptionReporter] - <Cannot open connection> java.sql.SQLException: 不支持事务 at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:373) at com.informix.jdbc.IfxSqliConnect.setAutoCommit(IfxSqliConnect.java:1812) at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:103) at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:278) at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3297) at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3277) at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:65) at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:704) at net.sf.hibernate.loader.Loader.doQuery(Loader.java:185) at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133) at net.sf.hibernate.loader.Loader.doList(Loader.java:955) at net.sf.hibernate.loader.Loader.list(Loader.java:946) at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:834) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1536) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1513) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1505) at com.adtec.moia.dao.hibernate.HibernateDaoImpl.find(HibernateDaoImpl.java:71) at com.adtec.moia.dao.hibernate.HibernateProxyImpl.find(HibernateProxyImpl.java:156) at com.adtec.moia.dao.hibernate.UserDaoHibernate.findUserByName(UserDaoHibernate.java:70) at com.adtec.moia.web.LogonAction.execute(LogonAction.java:65) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.adtec.moia.filter.HibernateSessionFilter.doFilter(HibernateSessionFilter.java:43) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.adtec.moia.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:62) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.adtec.moia.filter.LoggerFilter.doFilter(LoggerFilter.java:109) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.adtec.moia.filter.PermissionFilter.doFilter(PermissionFilter.java:77) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6724) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178) 2006-05-28 19:56:04,312 WARN [org.apache.struts.action.RequestProcessor] - <Unhandled Exception thrown: class com.adtec.moia.exception.DaoException> <2006-5-28 下午07时56分04秒 CST> <Error> <HTTP> <BEA-101017> <[ServletContext(id=13182325,name=rms,context-path=/rms)] Root cause of ServletException. com.adtec.moia.exception.DaoException: Cannot open connection at com.adtec.moia.dao.hibernate.HibernateProxyImpl.find(HibernateProxyImpl.java:159 关于Jute Forum的长期发展给官方的建议 |
话题树型展开 |
人气 | 标题 | 作者 | 字数 | 发贴时间 |
9162 | 向大哥们求救hibernate连接informix数据库的问题 | hanry_mary | 11042 | 2006-05-28 20:15 |
已读帖子 新的帖子 被删除的帖子 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |