HSQL实战使用手册.

不讲原理.只讲如何使用HSQL.


<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.0.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>


添加hsql 的jar包和链接包.


hsql的连接配置文件.
spring.properties
# database properties
app.jdbc.driverClassName=org.hsqldb.jdbcDriver
app.jdbc.url=jdbc:hsqldb:hsql://localhost
app.jdbc.username=sa
app.jdbc.password=


jdbc配置.
jdbc-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
">

<context:property-placeholder location="/WEB-INF/spring.properties" />

<!-- Enable annotation style of managing transactions -->
<tx:annotation-driven transaction-manager="transactionManager" />

<!-- Declare a datasource that has pooling capabilities-->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close"
p:driverClass="${app.jdbc.driverClassName}"
p:jdbcUrl="${app.jdbc.url}"
p:user="${app.jdbc.username}"
p:password="${app.jdbc.password}"
p:acquireIncrement="5"
p:idleConnectionTestPeriod="60"
p:maxPoolSize="100"
p:maxStatements="50"
p:minPoolSize="10" />

<!-- Declare a transaction manager -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
p:dataSource-ref="dataSource" />

</beans>


[size=x-large][b]下面就是重点了,即如何启动HSQL,并添加数据.[/b][/size]


启动服务器后,找到hsqldb-**.jar 右键点击 run as - java application
如下图.

[img]http://dl.iteye.com/upload/attachment/407397/38423de5-bfe9-39c3-a0cd-affa4839742c.png[/img]


首先启动hsql服务器.

[img]http://dl.iteye.com/upload/attachment/407399/e2d26b9a-08e5-3f6e-b6d4-12cf4ed1ea31.jpg[/img]

接着我们就可以在控制台看到hsql启动成功.

[img]http://dl.iteye.com/upload/attachment/407401/87f7d580-80b2-3a55-867d-74512ca5a3f4.png[/img]



然后准备打开GUI界面,选择下面的服务.

[img]http://dl.iteye.com/upload/attachment/407403/201650da-5184-3b8a-80dd-0fd3d43d8a26.png[/img]


出现图形配置界面后,选择图中的 Server 类型.
还有其它很多种类型,想知道各个的区别,自己google下就是了.这不讲理论,只讲使用.
点击OK.

[img]http://dl.iteye.com/upload/attachment/407407/c0428e37-0c52-34f0-a2a8-3de45dffc5d4.png[/img]

然后就是在图中创建表之类的操作了.

[img]http://dl.iteye.com/upload/attachment/407411/eef86146-ceea-3a9d-b0cc-169a3c3dcfa0.png[/img]


OVER!
GOOD LUCK!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值