我的测试应用程序.yml如下:
spring:
datasource:
url: jdbc:hsqldb:hsql:/localhost:9001/db/test
driverClassName: org.hsqldb.jdbcDriver
username: root
password:
jpa:
show-sql: false
hibernate:
ddl-auto: create-drop
use-new-id-generator-mappings: false
数据库连接配置类如下:
@Configuration
@ConfigurationProperties(prefix = "spring.datasource")
@EntityScan("com.x.project")
@EnableJpaRepositories("com.x.project")
public class DatabaseConfiguration {
@Value("${spring.datasource.driverClassName}")
private String driverClassName;
@Value("${spring.datasource.url}")
private String url;
@Value("${spring.datasource.username}")
private String username;
@Value("${spring.datasource.password}")
private String password;
@Bean
public DataSource dataSource() {
return new HikariDataSource(hikariConfig());
}
private HikariConfig hikariConfig() {
HikariConfig config = new HikariConfig();
config.setDriverClassName(driverClassName);
config.setJdbcUrl(url);
config.setUsername(username);
config.setPassword(password);
config.setPoolName("my db pool");
config.setMaximumPoolSize(2);
return config;
}
}
由于我是hsqldb的新手,我不确定在使用url-like时是否需要下载hsqldb服务器jdbc:hsqldb:hsql:/localhost:9001/db.
我得到的错误是:
原因:org.hsqldb.hsqlexception:数据库锁获取失败:lockfile:org.hsqldb.persist。lockfile@2e637605[file=null,exists=false,locked=false,valid=false,]方法:setpath原因:java.io.ioexception:
我该怎么解决这个问题?
暂无答案!
目前还没有任何答案,快来回答吧!