sorry for the html escape characters,
we tried the following and it does not work

        Class.forName("org.apache.calcite.jdbc.Driver");
                Properties info = new Properties();
                info.setProperty("lex", "JAVA");
                info.setProperty(InternalProperty.CASE_SENSITIVE.name(), 
"false");
                info.setProperty("defaultSchema", "hr");
                Connection connection = 
DriverManager.getConnection("jdbc:calcite:", info);
                CalciteConnection conn = 
connection.unwrap(CalciteConnection.class);
                SchemaPlus rootSchema = conn.getRootSchema();
                Schema schema = new ReflectiveSchema(target);
                rootSchema.add(schemaName, schema);
                return conn;




------------------ Original ------------------
From:  "xiaobo ";<guxiaobo1...@qq.com.INVALID>;
Send time: Friday, Feb 11, 2022 11:20 PM
To: "dev"<dev@calcite.apache.org>; 

Subject:  can we set a default schema for calcite connection to avoid writing 
schema names in sql



we have tried the following and it does not work


Class.forName("org.apache.calcite.jdbc.Driver");
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Properties info = new 
Properties();
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
info.setProperty("lex", "JAVA");
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
info.setProperty(CalciteConnectionProperty.CASE_SENSITIVE.camelName(), "false");
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
info.setProperty("defaultSchema", "hr");
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
Connection connection =
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; DriverManager.getConnection("jdbc:calcite:", info);
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
CalciteConnection conn =
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; connection.unwrap(CalciteConnection.class);
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
SchemaPlus rootSchema = conn.getRootSchema();
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;

Reply via email to