您好,登錄后才能下訂單哦!
本篇內容主要講解“springboot連接sqllite遇到的坑如何解決”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“springboot連接sqllite遇到的坑如何解決”吧!
2021-01-04 13:54:14.178 SvUSService [main] ERROR org.springframework.boot.SpringApplication - Application run failed java.lang.IllegalStateException: Failed to execute ApplicationRunner at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:807) at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:794) at org.springframework.boot.SpringApplication.run(SpringApplication.java:324) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) at org.skyviewpacs.us.SkyViewUsService.main(SkyViewUsService.java:23) Caused by: org.springframework.jdbc.UncategorizedSQLException: ### Error querying database. Cause: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (no such table: INFORMATION_SCHEMA.columns) ### The error may exist in file [E:\PACS\skyviewpacs\skyviewpacs-model\target\classes\org\skyviewpacs\model\dao\localMaster\TableMapper.xml] ### The error may involve org.skyviewpacs.model.dao.localMaster.TableMapper.getAllColumnName ### The error occurred while executing a query ### SQL: SELECT COLUMN_NAME,DATA_TYPE FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME= ?; ### Cause: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (no such table: INFORMATION_SCHEMA.columns) ; uncategorized SQLException; SQL state [null]; error code [1]; [SQLITE_ERROR] SQL error or missing database (no such table: INFORMATION_SCHEMA.columns); nested exception is org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (no such table: INFORMATION_SCHEMA.columns) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:89) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) at com.sun.proxy.$Proxy93.selectList(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230) at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:139) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:76) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) at com.sun.proxy.$Proxy149.getAllColumnName(Unknown Source) at org.skyviewpacs.service.service.impl.LogicalFieldImpl.getTableFeild(LogicalFieldImpl.java:73) at org.skyviewpacs.service.task.CommonConfigCacheLoadTask.putLogicalFieldInCache(CommonConfigCacheLoadTask.java:71) at org.skyviewpacs.service.task.CommonConfigCacheLoadTask.run(CommonConfigCacheLoadTask.java:125) at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:804) ... 5 common frames omitted Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (no such table: INFORMATION_SCHEMA.columns) at org.sqlite.core.DB.newSQLException(DB.java:941) at org.sqlite.core.DB.newSQLException(DB.java:953) at org.sqlite.core.DB.throwex(DB.java:918) at org.sqlite.core.NativeDB.prepare_utf8(Native Method) at org.sqlite.core.NativeDB.prepare(NativeDB.java:134) at org.sqlite.core.DB.prepare(DB.java:257) at org.sqlite.core.CorePreparedStatement.<init>(CorePreparedStatement.java:47) at org.sqlite.jdbc3.JDBC3PreparedStatement.<init>(JDBC3PreparedStatement.java:30) at org.sqlite.jdbc4.JDBC4PreparedStatement.<init>(JDBC4PreparedStatement.java:19) at org.sqlite.jdbc4.JDBC4Connection.prepareStatement(JDBC4Connection.java:35) at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:241) at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:205) at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:311) at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.logging.jdbc.ConnectionLogger.invoke(ConnectionLogger.java:55) at com.sun.proxy.$Proxy289.prepareStatement(Unknown Source) at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:87) at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:88) at org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(RoutingStatementHandler.java:59) at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:85) at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:143) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) at com.sun.proxy.$Proxy288.query(Unknown Source) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) ... 15 common frames omitted
以上是錯誤信息,是因為配置數據庫地址用了"",實際上應該用"/"
如下所示:
spring.datasource.master.driver-class-name= org.sqlite.JDBC spring.datasource.master.jdbcUrl=jdbc:sqlite:D:/SvUsSingleDB/master_us.db spring.datasource.master.username = spring.datasource.master.password=
1.在maven中引sqlite驅動
<dependency> <groupId>org.xerial</groupId> <artifactId>sqlite-jdbc</artifactId> </dependency>
為什么沒有版本號勒,都說了是springboot集成,你當springboot的父類引用是假的么,里面規定了版本號
2.在配置文件中關于DataSource的部分添加或修改
spring.datasource.driver-class-name=org.sqlite.JDBC spring.datasource.url=jdbc:sqlite:D:/dbfile/version.web/src/main/resources/Nversion.s3db
到此,相信大家對“springboot連接sqllite遇到的坑如何解決”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。