Closed qmatrix123 closed 1 year ago
I use these code to config the access_mode property, but it can not work.Please show me some hints.
using (var duckDBConnection = new DuckDB.NET.Data.DuckDBConnection(budiler.ConnectionString))
{
duckDBConnection.Open();
var command = duckDBConnection.CreateCommand();
command.CommandText = "set access_mode=READ_ONLY;";
var executeNonQuery = command.ExecuteNonQuery();
command.CommandText = "SELECT current_setting('access_mode');";
var executeScalar = command.ExecuteScalar();
Thread.Sleep(1000 * 3);
Console.WriteLine(executeScalar);
}
You cannot specify connection properties in the connection string yet but there is an open issue for that: #49
You should be able to achieve it by using Configure Api
Your code also works for me with DuckDB 0.6.1:
Properties ro_prop = new Properties(); ro_prop.setProperty("duckdb.read_only", "true"); Connection conn_ro = DriverManager.getConnection("jdbc:duckdb:/tmp/my_database", ro_prop);
As java, I can pass configuration to connection.How can I do the same thing with the lib.
Thanks.