简体   繁体   English

如何读取将作为 MultipartFile 参数传递的 SQLite 文件? (在 java/kotlin 中)

[英]How could I read SQLite file which will be passed as MultipartFile parameter? (in java/kotlin)

I have to write REST API which will parse an SQLite file and parse&save its data into the server's MySQL DB.我必须编写 REST API 它将解析 SQLite 文件并将其数据解析并保存到服务器的 Z497757A01AFA459

The SQLite file will be passed as a.zip file( MultipartFile ), so I have to unzip it, and then read the unzipped file as DTO. SQLite 文件将作为 .zip 文件( MultipartFile )传递,所以我必须解压缩它,然后将解压缩的文件作为 DTO 读取。

The code will be as following..代码如下..

fun parseSQLite(zipFile: MultipartFile) {
  val file = unzip(zipFile)

  val sqliteDB = somethingLibrary.load(file)

  doParseTable(sqliteDB.execute("select * from TestTable"))
}

I found there are sqlite-jdbc library( https://github.com/xerial/sqlite-jdbc ), but it seems like it might not work in my case.我发现有sqlite-jdbc库( https://github.com/xerial/sqlite-jdbc ),但它似乎不适用于我的情况。 I think I need mmap I/O, but are there any JAVA library for it?我想我需要 mmap I/O,但是有没有 JAVA 库呢?

Thanks!谢谢!

For those whom may face a similar problem;对于那些可能面临类似问题的人; I decided to add a step that saves "unzipped SQLite DB" into the server's local storage, and then load DB from it.我决定添加一个步骤,将“解压缩的 SQLite DB”保存到服务器的本地存储中,然后从中加载 DB。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何读取 Kotlin 另一个目录中的文件? - How to Read a File which is in another directory in Kotlin? 必需的MultipartFile参数'file'不存在Java Spring MVC - Required MultipartFile parameter 'file' is not present java spring mvc 当我从Angular 4请求时,所需的MultipartFile参数'file'不存在 - Required MultipartFile parameter 'file' is not present when I request from Angular 4 Saxon-HE Java 扩展 - 如何访问作为参数传递的 xsl 变量的值? - Saxon-HE Java Extension - How to I access the value of a xsl-variable which is passed as a parameter? java - 如何使用spring boot在java中将multipartfile参数设置为“不需要”? - How to set a multipartfile parameter as "not required" in java with spring boot? 如何打印在Java函数中作为参数传递的Enum值? - How to print the value of Enum which is passed as parameter in the function in Java? 如何使用Java读取sqlite数据库文件? (包) - How to read an sqlite database file in Java? (Package) 如何读取Java资源文件夹中的文件? - How can I read my file which is in a resources folder in Java? 如何检查哪个Swing组件作为参数传递? - How do I check which Swing component is being passed as a parameter? 如何使用 Kotlin/Java 从我的 s3 存储桶中读取 Excel 文件 (xlsx)? - How can I read an Excel file (xlsx) from my s3 bucket with Kotlin/Java?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM