我想通过Gavin King的Java Persistence与Hibernate学习Hibernate。无法从底层数据库获取连接! - HSQL DB
我刚刚下载从这个位置http://downloads.jboss.org/hibernate/caveatemptor/jpwh-gettingstarted-070401.zip
书中给出的例子,我开始我的HSQL DB使用蚂蚁startdb和数据库成功启动。
当试图运行目标的SchemaExport我收到以下错误..
SchemaExport工具:[hibernatetool] 执行的Hibernate工具与 标准配置[hibernatetool] 1.任务:就是hbm2ddl(生成数据库模式)[hibernatetool] 18:07:56,555 INFO Environment:500 - Hibernate 3.2.0.cr5 [hibernatetool] 18:07:56,555 INFO Environment:533 - hibernate.properties not fo und [hibernatetool] 18: 07:56,555信息 环境:667 - 字节码提供呃 名称:CG LIB [hibernatetool] 18:07:56571信息环境:584 - 使用JDK 1.4的java.sql.Time邮票 处理[hibernatetool] 18:07:56617 信息配置:1384 - 从文件中配置 :H ibernate.cfg.xml [hibernatetool] 18:07:56680 INFO 配置:507 - 读映射 从RES乌尔斯河:你好/ Message.hbm.xml [hibernatetool] 18:07:56758 INFO HbmBinder:300 - 映射类: hello.Message - > MESSAGES [hibernatetool] 18:07:56,851信息配置:1465 - 配置的SessionFactor y:null [hibernatetool] 18:07:56,851信息 方言:141 - 使用方言: org.hibernate.di alect.HSQLDialect [hibernatetool] 18:07:56914 INFO SchemaExport工具:154 - 运行就是hbm2ddl 架构EXP ORT [hibernatetool] 18:07:56914 INFO SchemaExport工具: 174 - 写入生成的模式到文件: C:\用户\拉梅什\桌面\教程\休眠\休眠 代码样本\ jpwh- gettingstarted-070401 \ HelloWorld的天然\的HelloWorld-ddl.sql [hibernatetool] 18: 07:56,914 INFO SchemaExport:179 - 导出生成 模式到数据库[hibernatetool] 18:07:56,914信息 C3P0ConnectionProvider:50 - C3P0使用 驱动程序:在org.hsqldb.jdbcDriver URL: JDBC:HSQLDB:HSQL://本地主机 [hibernatetool] 18:07:56914 INFO C3P0ConnectionProvider:51 - 连接 正确关系:{用户= SA} [hibernatetool] 18:07:56914 INFO C3P0ConnectionProvider:54 - 自动提交 模式:假[hibernatetool] 18:08:26554 WARN BasicResourcePool:1222 - com.mchange.v2.resou [email protected] - 收购尝试失败!清理未完成的采集。尽管 试图获取所需的新资源 资源,但我们仍然获得了比最大允许获取次数 (30)更多的 。 [hibernatetool] 18:08:26554 ERROR SchemaExport工具:202 - 架构出口 不成功
[hibernatetool]值java.sql.SQLException: 连接无法从 前作基础数据库获取! [hibernatetool]在 com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.j AVA:104)[hibernatetool]在 com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.che ckoutPooledConnection(C3P0PooledConnectionPool.java :236) [hibernatetool]在 com.mchange.v2.c3p0.PoolBackedDataSource.getConnectio N(PoolBackedDataSource.java:94) 在[hibernatetool] org.hibernate.connection.C3P0ConnectionProvider.getCo nnection(C3P0ConnectionProvider.java :35) [hibernatetool] at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionH elper.prepare(ManagedProviderConnectio nHelper.java:28) [hibernatetool]在 org.hibernate.tool.hbm2ddl.SchemaExport.execute(舍姆 aExport.java:180)[hibernatetool]
在 org.hibernate.tool.hbm2ddl.SchemaExport.create (模式 Export.java:133)[hibernatetool]
在 org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(血红蛋白 m2DDLExporterTask.java:55) 在 org.hibernate.tool.ant [hibernatetool]。 HibernateToolTask.execute(Hibe rnateToolTask.java:171) [hibernatetool] at org.apache.tools.ant.UnknownElement.execute(UnknownEl ement.java:291)[hibernatetool]
在 sun.reflect.NativeMethodAccessorImpl.invoke0(母语 中号ethod)[hibernatetool]在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMet hodAccessorImpl.java:39) [ hibernatetool]在 sun.reflect.DelegatingMethodAccessorImpl.invoke(德勒 atingMethodAccessorImpl.java:25) [hibernatetool]在 java.lang.reflect.Method.invoke(Method.java:597) [hibernatetool]在 有机apache.tools.ant.dispatch.DispatchUtils.execute(D ispatchUtils.java:106)[hibernatetool] at org.apache.tools.ant.Task.perform(Task.java:348) [hibernatetool]在 org.apache.tools.ant.Target.execute(Target.java:390) [hibernatetool]在 有机.apache.tools.ant.Target.performTasks(Target.java: 411)[hibernatetool]在 org.apache.tools.ant.Project.executeSortedTargets(临 ject.java:1397)[hibernatetool]
在 org.apache.tools.ant.Project.executeTarget(Project.ja VA:1366)[hibernatetool]在 org.apache.tools.ant.helper.DefaultExecutor.executeTa rgets(DefaultExecutor.java:41) [hibernatetool ]在 org.apac he.tools.ant.Project.executeTargets(Project.j AVA:1249)[hibernatetool]在 org.apache.tools.ant.Main.runBuild(Main.java:801) [hibernatetool]在 org.apache .tools.ant.Main.startAnt(Main.java:218) [hibernatetool] at org.apache.tools.ant.launch.Launcher.run(Launcher。JAV 一个:280)[hibernatetool]在 org.apache.tools.ant.launch.Launcher.main(Launcher.ja VA:109)[hibernatetool]所致: com.mchange.v2.resourcepool.CannotAcquireResourceExce ption:一个ResourcePool不能从 工厂或工厂获取资源 。 [hibernatetool]
在 com.mchange.v2.resourcepool.BasicResourcePool.awaitAc 叠纸(BasicResourcePool.java:970) [hibernatetool]在 com.mchange.v2.resourcepool.BasicResourcePool.checkou tResource(BasicResourcePool.java :208) [hibernatetool]在 com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.che ckoutPooledConnection(C3P0PooledConnectionPool.java:232) [hibernatetool] ...同时执行时发生24更 [hibernatetool] 1个错误 。 [hibernatetool]错误#1: java.sql.SQLException:连接 无法从 底层数据库中获得! [hibernatetool] 18:08:26569 WARN BasicResourcePool:1222 - com.mchange.v2.resou [email protected] - 采集尝试失败!!!清理未完成的采集。虽然 试图获取所需的新 的资源,我们的固定资产投资导致成功超过允许 获取尝试(30)的最大数量.`
更 我没有关于任何hiberate或太多的知识HSQL ..
有人请说明这里有什么错?
感谢
编辑:我试图运行项目helloworld-native
。
在startdb蚂蚁的build.xml给出的目标是如下:
<!-- Start the HSQL DB server -->
<target name="startdb" description="Run HSQL database server with clean DB">
<!-- Delete database files -->
<delete dir="${database.dir}"/>
<java classname="org.hsqldb.Server"
fork="yes"
classpathref="project.classpath"
failonerror="true">
<arg value="-database.0"/>
<arg value="file:${database.dir}/db"/>
</java>
</target>
,当我运行命令ant startdb
我看到下面的输出:
startdb:
[delete] Deleting directory C:\Users\Ramesh\Desktop\Tutorials\hibernate\Hibernate Code samples\jpwh-gettingstarted-070401\helloworld-native\database
[java] [[email protected]]: [Thread[main,5,main]]: checkRunning(false) entered
[java] [[email protected]]: [Thread[main,5,main]]: checkRunning(false) exited
[java] [[email protected]]: Startup sequence initiated from main() method
[java] [[email protected]]: Loaded properties from [C:\Users\Ramesh\Desktop\Tutorials hibernate\Hibernate Code samples\jpwh-gettingstarted-070401\helloworld-native\server.properties]
[java] [[email protected]]: Initiating startup sequence...
[java] [[email protected]]: Server socket opened successfully in 29 ms.
[java] [[email protected]]: Database [index=0, id=0, db=file:database/db, alias=] opened sucessfully in 469 ms.
[java] [[email protected]]: Startup sequence completed in 523 ms.
[java] [[email protected]]: 2010-11-08 22:11:08.027 HSQLDB server 1.8.0 is online
[java] [[email protected]]: To close normally, connect and execute SHUTDOWN SQL
[java] [[email protected]]: From command line, use [Ctrl]+[C] to abort abruptly
然后,我想我只在服务器模式下运行HSQL DB(从上面的输出)..
请告诉我还有什么我丢失..
尝试与MySQL..and它工作..不知道什么是probelm? – javanoob 2010-11-07 13:23:19