i tried zips, ZIPS and every available lex. Still dont work. 
Is my program code right ? 
Julian 

    Julian Hyde <[email protected]> schrieb am 18:29 Dienstag, 20.Dezember 2016:
 

 Maybe the “zips” table is upper-case. If so, your SQL query should be

  select count(*) from mongoDB.ZIPS

It may not be the cause, but you should also change

  defaultSchema: ‘mongo'

to

  defaultSchema: 'mongoDB'

The difference between sqlline and Java is that sqlline is using the default 
lexical policy (because sqlline doesn't pass a Properties object when it opens 
a connection). If you want to use a lexical policy from sqlline, you need to 
add “;lex=SQL_SERVER” to the connect string.

Julian

 
> On Dec 20, 2016, at 8:24 AM, Julian Stenzel <[email protected]> 
> wrote:
> 
> Hello Team,
> atm iam trying to execute some queries in java. 
> my code:
> Class.forName("org.apache.calcite.jdbc.Driver");info = new 
> Properties();info.setProperty("lex", "SQL_SERVER");
> connection = DriverManager.getConnection("jdbc:calcite:database/config.json", 
> info);statement = connection.createStatement();
> ResultSet resultSet = statement.executeQuery("select count(*) from 
> mongoDB.zips");//                                                             
>          or select count(*) from zips
> my config.json:
> {  version: '1.0',  defaultSchema: 'mongo',  schemas: [    {      type: 
> 'custom',      name: 'mongoDB',      factory: 
> 'org.apache.calcite.adapter.mongodb.MongoSchemaFactory',      operand: {      
>   host: 'localhost',        database: 'darwin_test',
>              }    }  ]}
> i encounter Caused by: org.apache.calcite.sql.validate.SqlValidatorException: 
> Table 'mongoDB.zips' not found. The query works fine with sqlline.bat and the 
> same config (config.json).  Am I making any obvious mistake?Thank youJulian   
>                                                                               
>              
> 
> 


   

Reply via email to