-
Language:
English
-
Language:
English
Red Hat Training
A Red Hat training course is available for Red Hat JBoss Data Virtualization
2.7. Example Deployment
EmbeddedServer es = new EmbeddedServer(); EmbeddedConfiguration ec = new EmbeddedConfiguration(); //set any configuration properties ec.setUseDisk(false); es.start(ec); //example of adding a translator by class - this will make a default instance available with the default name of oracle es.addTranslator(OracleExecutionFactory.class); //add a translator by instance - this is functionally equivalent to using a vdb.xml translator override OracleExecutionFactory oef = new OracleExecutionFactory(); //configure and start the instance oef.setDatabaseVersion("11.0"); oef.start(); es.addTranslator("my-oracle", oef); //add a connection factory provider if needed //the default is to perform a jndi lookup of the datasource names given //however out of a container you will likely need to manually inject the necessary connection factory ConnectionFactoryProvider<DataSource> cfp = new EmbeddedServer.SimpleConnectionFactoryProvider<DataSource>(...); es.addConnectionFactoryProvider("ora-ds", cfp); //add a vdb //physical model ModelMetaData mmd = new ModelMetaData(); mmd.setName("my-schema"); mmd.addSourceMapping("my-schema", "my-oracle", "ora-ds"); //virtual model ModelMetaData mmd1 = new ModelMetaData(); mmd1.setName("virt"); mmd1.setModelType(Type.VIRTUAL); mmd1.setSchemaSourceType("ddl"); mmd1.setSchemaText("create view \"my-view\" OPTIONS (UPDATABLE 'true') as select * from \"my-table\""); es.deployVDB("test", mmd, mmd1);