3 Replies Latest reply on Nov 9, 2012 5:38 PM by rareddy

    Using custom datasource with a single override

    ileitch

      I implemented a MyDataSource which extends DataSource  as a Connector for an embedded Teiid server as follows:

       

                                   MyDataSource myDataSource = new MyDataSource(…);

                                      EmbeddedServer.ConnectionFactoryProvider<DataSource> myProvider = new                                                                EmbeddedServer.ConnectionFactoryProvider<DataSource>() {

                                                      @Override

                                                      public DataSource getConnectionFactory() throws TranslatorException {

                                                                      return myDataSource;

                                                      }

                                      };

       

      How do I specify a datasource like this for a Custom Translator in a Dynamic VDB environment?

       

      The idea is to reuse the DataSource for the connector. I do not want to implement a full connector (ManagedConnectionFactory, etc..) as specified in the guide.

       

      Thanks!

        • 1. Re: Using custom datasource with a single override
          rareddy

          Look at the example in the embedded kit, it shows how to define that.

           

          embedded.addConnectionFactoryProvider(name, instance);

          embedded.addTranslator(string, executionfactory);

           

          note unless you provide, there are no built in pooling for your connections. CaonnectionFactory provides that abstraction. The guide written more for delevoping a connector in RAR form to be deployed in JBoss AS.

           

          Ramesh..

          • 2. Re: Using custom datasource with a single override
            ileitch

            This is working in embedded Teiid. Is there a way to use it in a dynamic vdb under Jboss AS?

            • 3. Re: Using custom datasource with a single override
              rareddy

              It should, however not sure what you mean by the does it work in Dynamic VDB. There the vdb definition semantics and deployment semantics and connection factory configuration is all specific and well defined, you would have to redo your example to fit to that model. The schema you defined in the model does not change.

               

              Ramesh..