4 Replies Latest reply on Oct 25, 2013 1:34 PM by Ivan Chan

    Connecting to MongoDB

    Ivan Chan Apprentice

      Hi,

       

      I am trying to use Teiid embedded version 8.6 to connect to MongoDB.  And I have database name, "test", and collection, "grades".

       

      And I have created a connection factory using the following code:

       

          public Object getConnectionFactory() throws Exception {
              MongoDBManagedConnectionFactory mongoDBManagedConnectionFactory = new MongoDBManagedConnectionFactory();
              mongoDBManagedConnectionFactory.setRemoteServerList(remoteServerList);
              mongoDBManagedConnectionFactory.setUsername(username);
              mongoDBManagedConnectionFactory.setPassword(password);
              mongoDBManagedConnectionFactory.setDatabase("test");
              return mongoDBManagedConnectionFactory.createConnectionFactory();
          }

       

      However, I got this exception when I try to delpoy the VDB.

       

      Caused by: org.teiid.deployers.VirtualDatabaseException: TEIID40095 TEIID31070 Empty model;There are no tables, procedures or functions defined in this model mongoDBDS

       

      Do I have to pass the collection to the model using import properties?  If so, what is the import property name?

       

      Thanks,

       

      Ivan