本文介绍了HSQLDB管理与蚂蚁一个新的独立的数据库表未找到声明]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算使用HSQLDB,我想用蚂蚁的例子。

构建文件:

 <目标名称=create.tables>
  <回声>创建使用表:$ {db.driver} $ {} db.url配置参数和LT; /回声>
  < SQL驱动程序=$ {} db.driver
      URL =$ {} db.url配置参数
      用户id =$ {} db.username
      密码=$ {} db.password
      的onerror =继续
      SRC =HSQLDB / create_cars.sql>
      <类路径REFID =hsqldb.database/>
  < / SQL>
< /目标与GT;<目标名称=load.data>
  <回声>加载数据使用:$ {db.driver} $ {} db.url配置参数和LT; /回声>
  < SQL驱动程序=$ {} db.driver
      URL =$ {} db.url配置参数
      用户id =$ {} db.username
      密码=$ {} db.password
      的onerror =继续
      SRC =HSQLDB / load_data.sql>
      <类路径REFID =hsqldb.database/>
  < / SQL>
< /目标与GT;

属性:

  db.driver = org.hsqldb.jdbcDriver
= db.url配置参数的jdbc:hsqldb的:文件:HSQLDB / dbcars
db.username = SA
db.password =

create_tables.sql:

  CREATE TABLE汽车(
     ID INTEGER NOT NULL PRIMARY KEY,
     说明VARCHAR(255)
);

load_data.sql:

  INSERT INTO汽车(ID,描述)VALUES(1,'头车');
INSERT INTO汽车(ID,描述)VALUES(2,'第二辆车');

在create.tables目标的作品,但是load.data给这个错误:

  [SQL]值java.sql.SQLException:表在声明中没有找到[SELECT * FROM汽车]


解决方案

通常这是短时间的数据库连接造成的。该表定义不坚持,不能后来发现。请参见连接属性的列表,你可以使用:

那就试试这个:

  db.driver = org.hsqldb.jdbcDriver
= db.url配置参数的jdbc:hsqldb的:文件:HSQLDB / dbcars;关机= TRUE
db.username = SA
db.password =

如果它不工作,试试这个:

  db.driver = org.hsqldb.jdbcDriver
= db.url配置参数的jdbc:hsqldb的:文件:HSQLDB / dbcars; hsqldb.write_delay = FALSE
db.username = SA
db.password =

I'm planning to use HSQLDB, I'm trying an example with ant.

the build file:

<target name="create.tables">
  <echo>Creating tables using: ${db.driver} ${db.url}</echo>
  <sql driver="${db.driver}"
      url="${db.url}"
      userid="${db.username}"
      password="${db.password}"
      onerror="continue"
      src="hsqldb/create_cars.sql">
      <classpath refid="hsqldb.database" />
  </sql>
</target>

<target name="load.data">
  <echo>Load Data Using: ${db.driver} ${db.url}</echo>
  <sql  driver="${db.driver}"
      url="${db.url}"
      userid="${db.username}"
      password="${db.password}"
      onerror="continue"
      src="hsqldb/load_data.sql">
      <classpath refid="hsqldb.database" />
  </sql>
</target>

properties:

db.driver=org.hsqldb.jdbcDriver
db.url=jdbc:hsqldb:file:hsqldb/dbcars
db.username=sa
db.password=

create_tables.sql:

CREATE TABLE cars (
     id INTEGER NOT NULL PRIMARY KEY,
     description VARCHAR(255)
) ;

load_data.sql:

INSERT INTO cars (id, description) VALUES (1, 'first car') ;
INSERT INTO cars (id, description) VALUES (2, 'second car') ;

the create.tables target works, but load.data give this error:

[sql] java.sql.SQLException: Table not found in statement [ SELECT * FROM cars]
解决方案

Usually this is caused by a short duration connection to the database. The table definition is not persisted and cannot be found later. See the list of connection properties you can use:

http://www.hsqldb.org/doc/2.0/guide/dbproperties-chapt.html

Then try this:

db.driver=org.hsqldb.jdbcDriver
db.url=jdbc:hsqldb:file:hsqldb/dbcars;shutdown=true
db.username=sa
db.password=

If it doesn't work, try this:

db.driver=org.hsqldb.jdbcDriver
db.url=jdbc:hsqldb:file:hsqldb/dbcars;hsqldb.write_delay=false
db.username=sa
db.password=

这篇关于HSQLDB管理与蚂蚁一个新的独立的数据库表未找到声明]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 08:33