String path="H:\\数据库链接测试\\DB.db";
String conn_str = "data source=" + path;
conn = new SQLiteConnection(conn_str);
conn.Open();
连接数据库,出现异常 Unable to open the database file
是不是 中文路径问题,望大神们 给个建议,
用最新的驱动程序已经支持中文和带空格的路径名了
<!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.15.1</version>
</dependency>
不支持中文路径和带空格的路径,另外连接串中可设置编码格式,避免读出来的数据是乱码。
DataSource=filename;Version=3;UseUTF8Encoding=True;