`

hsqldb起步-2

阅读更多

学习和部署 h2 database 算了, h2 database 是 hsqldb 的作者后来的又一力作 ,更好用,更高效

 

1.hsqldb 有如下功能:

 

核心:

    HyperSQL RDBMS Engine (HSQLDB)

    HyperSQL JDBC Driver

 

扩展:

    Database Manager (GUI database access tool, with Swing and AWT versions)

    Sql Tool (command line database access tool) - sqltool.jar

 

 

2.启动gui

 

方式a:

设置环境变量后


bat方式启动:


方式b:

双击hsqldb.jar,更爽

 

3.hsqldb三种数据保存方式:

->内存

->文件

->jar中

 

若file则生成这些文件:

  • test.properties 记录数据库设置

  • test.script 表定义和数据库对象的定义语句

  • test.log 记录数据库最近的日志和更改

  • test.data 缓存表中的数据

  • test.backup 对最近表中数据的备份

  • test.lobs

->test.lck用来记录数据库正在open

->当SHUTDOWN则移除test.log, test.lck

 

4.若在window下,则在c盘下的对应路径创建数据库

  Connection c = DriverManager.getConnection("jdbc:hsqldb:file:/opt/db/testdb", "SA", "123");

 

5.两个或许不同

Class.forName("org.hsqldb.jdbc.JDBCDriver" );
Class.forName("org.hsqldb.jdbcDriver" );

 

6.当最后一个连接关闭,则关闭数据库.[我也不太明白??]

jdbc:hsqldb:file:/opt/db/testdb;shutdown=true

 

7.

如果testdb存在,则连接到testdb,如果不存在则抛出异常

jdbc:hsqldb:file:/opt/db/testdb;ifexists=true

如果testdb不存在,则创建

jdbc:hsqldb:file:/opt/db/testdb

 

8.支持的数据类型

  • Numeric types TINYINT, SMALLINT, INTEGER and BIGINT are types with fixed binary precision. These types are more efficient to store and retrieve. NUMERIC and DECIMAL are types with user-defined decimal precision. They can be used with zero scale to store very large integers, or with a non-zero scale to store decimal fractions. The DOUBLE type is a 64 bit, approximate floating point types. HyperSQL even allows you to store infinity in this type.

  • The BOOLEAN type is for logical values and can hold TRUE, FALSE or UNKNOWN. Although HyperSQL allows you to use one and zero in assignment or comparison, you should use the standard values for this type.

  • Character string types are CHAR(L), VARCHAR(L) and CLOB . CHAR is for fixed width strings and any string that is assigned to this type is padded with spaces at the end. Do not use this type for general storage of strings. If you use CHAR without the length L, then it is interpreted as a single character string. Use VARCHAR(L) for general strings. There are only memory limits and performance implications for the maximum length of VARCHAR(L). If the strings are larger than a few kilobytes, consider using CLOB. The CLOB types is for very large strings. Do not use this type for short strings as there are performance implications. The CLOB type is a better choice for the storage of long strings. By default LONGVARCHAR is a synonym for a long VARCHAR and can be used without specifying the size. You can set LONGVARCHAR to map to CLOB, with the sql.longvar_is_lob connection property or the SET DATABASE SQL LONGVAR IS LOB TRUE statement.

  • Binary string types are BINARY(L), VARBINARY(L) and BLOB. Do not use BINARY(L) unless you are storing keys such as UUID. This type pads short binary strings with zero bytes. BINARY without the length L means a single byte. Use VARBINARY(L) for general binary strings, and BLOB for large binary objects. You should apply the same considerations as with the character string types. By default LONGVARBINARY is a synonym for a long VARCHAR and can be used without specifying the size. You can set LONGVARBINARY to map to BLOB, with the sql.longvar_is_lob connection property or the SET DATABASE SQL LONGVAR IS LOB TRUE statement.

  • The BIT(L) and BITVARYING(L) types are for bit maps. Do not use them for other types of data. BIT without the length L argument means a single bit and is sometimes used as a logical type. Use BOOLEAN instead of this type.

  • The datetime types DATE, TIME and TIMESTAMP , together with their WITH TIME ZONE variations are available. Read the details in this chapter on how to use these types.

  • The INTERVAL type is very powerful when used together with the datetime types. This is very easy to use, but is supported mainly by "big iron" database systems. Note that functions that add days or months to datetime values are not really a substitute for the INTERVAL type. Expressions such as (datecol - 7 DAY) > CURRENT_DATE are optimised to use indexes when it is possible, while the equivalent function calls are not optimised.

  • The OTHER type is for storage of Java objects. If your objects are large, serialize them in your application and store them as BLOB in the database.

  • The ARRAY type supports all base types except LOB and OTHER types. ARRAY data objects are held in memory while being processed. It is therefore not recommended to store more than about a thousand objects in an ARRAY in normal operations with disk based databases. For specialised applications, use ARRAY with as many elements as your memory allocation can support.

9.关于SA

This user is automatically created with a new database and has the DBA role . Initially, the password for this user is an empty string. After connecting to the new database as this user, it is possible to change the password, create other users and created new schema objects. The SA user can be dropped by another user that has the DBA role.

 

10.

学习和部署 h2 database 算了, h2 database 是 hsqldb 的作者后来的又一力作 ,更好用,更高效

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 大小: 11.1 KB
  • 大小: 21.8 KB
分享到:
评论

相关推荐

    HSQLDB快速连接数据库

    2. **SQL问题**:探讨了HSQLDB对SQL标准的支持程度,包括对各种SQL语句(如SELECT、UPDATE等)的解释和示例,以及如何使用HSQLDB来管理数据完整性约束。 3. **UNIX下快速起步**:提供了一套适用于UNIX系统的快速入门...

    HSQLDB 中文文档

    - **部署问题**:HSQLDB支持多种部署环境,包括UNIX系统下的快速起步指导,以及针对不同操作模式和表的部署策略,确保数据库的稳定运行和高效使用。 通过以上知识点的阐述,可以看出HSQLDB不仅是一款功能强大的轻量...

    JAVA-SERVLET-+-MYSQL-+-JBOSS-开发起步

    ### JAVA-SERVLET-+-MYSQL-+-JBOSS-开发起步 #### 一、Java Servlet、Jboss、Mysql、Eclipse 开发介绍 在现代Web应用开发领域中,Java Servlet技术结合MySQL数据库以及JBoss应用服务器是构建企业级应用的常见组合...

    【备】spring-boot-demo

    例如,如果在 classpath 中发现了 HSQLDB 数据库驱动,那么就会自动配置相关的数据源。 5. **使用 Spring Boot 实现 RESTful API** - 添加 `spring-boot-starter-web` 起步依赖。 - 创建 Controller 类,使用 `@...

    spring-boot-reference2018最新版

    2. **起步依赖(Starters)** Spring Boot的起步依赖是一系列精心打包的Maven或Gradle依赖,它们包含了开发特定功能所需的所有依赖。例如,如果你想开发一个Web应用,只需要添加`spring-boot-starter-web`依赖即可...

    01-SpringBoot-Demo

    2. **起步依赖(Starter POMs)**: Spring Boot通过一系列的"starter" pom文件,简化了项目的构建配置。例如,如果你想使用MyBatis,只需要引入`spring-boot-starter-data-jpa`依赖即可,其他的依赖和配置都会自动完成...

    spring-boot-cli安装包

    例如,如果你的类路径中有HSQLDB,那么Spring Boot就会自动配置内存数据库。 5. **内嵌Servlet容器**: - Spring Boot可以内嵌Tomcat、Jetty或Undertow等Servlet容器,无需额外部署WAR文件,简化了开发流程。 6. ...

    JAVASERVLET+MYSQL+JBOSS开发起步[汇编].pdf

    在本文中,我们将探讨如何使用Java Servlet、MySQL、JBoss以及Eclipse进行软件开发的起步过程。首先,我们需要确保拥有所有必要的工具和库。以下是一份详尽的准备清单: 1. **Tomcat**:作为Servlet容器,Tomcat ...

    spring-boot-cli-1.1.9.RELEASE-bin.zip

    2. **Spring Boot CLI**: CLI是Command Line Interface的缩写,是Spring Boot提供的命令行工具。它可以让你直接运行Groovy脚本来创建和运行Spring应用,无需构建整个项目。这在快速原型开发或者测试小段代码时非常...

    springboot - 2.1.2realease版本jar包

    2. **起步依赖(Starters)**:SpringBoot的起步依赖是一组Maven或Gradle的依赖管理模块,它们封装了常用功能的依赖集合,如`spring-boot-starter-web`用于web开发,`spring-boot-starter-data-jpa`用于数据库操作等...

    spring-boot-1.5.x.zip

    2. **起步依赖**:Spring Boot通过“起步依赖”(Starter POMs)来管理依赖,如`spring-boot-starter-web`包含Tomcat和Spring MVC。这简化了Maven或Gradle的配置,开发者只需要引入相应的起步依赖,就能获得所需的...

    springboot-demo

    1. **起步依赖(Starters)**:Spring Boot通过一系列的起步依赖来简化Maven或Gradle的配置,这些起步依赖包含了一组默认的依赖集合,比如`spring-boot-starter-web`用于web开发,`spring-boot-starter-data-jpa`...

    中文 文档spring-boot-reference-guide-zh.zip_chaink3s_experiment65w_g

    例如,如果在类路径下发现`HSQLDB`,那么Spring Boot将自动配置一个内存数据库。 - **起步依赖**:Spring Boot通过起步依赖简化了添加和管理Maven或Gradle项目的依赖。如需使用某项功能,只需引入相应的起步依赖...

    spring-boot-2.7.18.zip

    3. **起步依赖(Starter POMs)**:SpringBoot 提供了一系列的起步依赖,开发者只需在 Maven 或 Gradle 的构建文件中引入相应依赖,即可快速搭建所需环境,如 `spring-boot-starter-web` 用于 web 开发,`spring-...

    spring-boot-参考指南

    例如,如果项目中有HSQLDB库,Spring Boot会自动配置内存数据库;有JDBC依赖,它会配置数据源。 文档中还将详细讲解如何创建“可执行的jar”(Executable JARs)。Spring Boot允许你打包应用为一个可运行的jar,...

    SpringBoot-master

    1. **起步依赖(Starters)**:SpringBoot 的起步依赖是其简洁配置的关键。它们是一组预定义的 Maven 或 Gradle 依赖集合,例如 `spring-boot-starter-web` 用于构建 Web 应用,`spring-boot-starter-data-jpa` 用于...

    基于SpringBoot开发的校内信息共享平台-源码

    2. **起步依赖**:SpringBoot提供了许多起步依赖(Starter POMs),这些依赖简化了Maven或Gradle配置,比如`spring-boot-starter-web`用于web开发,`spring-boot-starter-data-jpa`用于数据库访问。 3. **内嵌...

    spring-boot-mmanyexamples.zip

    1. **快速起步与项目构建** Spring Boot通过提供默认配置,使得开发者能够快速启动项目。只需添加必要的依赖,就可以创建一个完整的可运行的JAR或WAR。"spring-boot-mmanyexamples"可能包含了多个示例项目,每个...

    this-Mytest.rar

    2. **起步依赖(Starter POMs)**:Spring Boot通过一系列“起步依赖”POMs帮助开发者快速选择所需功能。例如,`spring-boot-starter-web`提供了Web开发的基本依赖,包括Tomcat服务器和Spring MVC。 3. **内嵌式Web...

Global site tag (gtag.js) - Google Analytics