If they are two separate schemas, with two different names (in the vdb.xml file, the "source" element name under "model") then Teiid will issue two different queries.
I deploy a one VDB that contains 2 models for the 2 DataBases
List<ModelMetaData> models = new ArrayList<ModelMetaData>() ; String dbName1 = "Orders" ModelMetaData modelMetaData = new ModelMetaData(); modelMetaData.setName( serviceName + "VDB" ); modelMetaData.addProperty("importer.tableTypes", "TABLE,VIEW"); modelMetaData.addSourceMapping(dbName1, "mysql5", dbName1+ "ds"); models.add(modelMetaData) ; // dbName1 = "WorldIndicators" modelMetaData = new ModelMetaData(); modelMetaData.setName( serviceName + "VDB" ); modelMetaData.addProperty("importer.tableTypes", "TABLE,VIEW"); modelMetaData.addSourceMapping(dbName1, "mysql5", dbName1+ "ds"); models.add(modelMetaData) ; testVDBMetaData = new VDBMetaData(); testVDBMetaData.setXmlDeployment(true); testVDBMetaData.setName("test"); testVDBMetaData.setModels(models); deployVDB(testVDBMetaData, null);
something wrong in my example ?
it's a way to deploy these 2 databases to force teiid to execute such this case in one query ?
It looks about right. There is an example in the embedded kit if you want to reference that does similar integration between file and relational data source. If you are not familiar with Teiid and how it operates, I suggest you start with Designer based tooling to build VDBs and use Teiid Server to verify your usecase. Then you can come back to embedded to see how you can do the same programatically.
Based upon what you have above, the short answer is that separate source queries will be issued as you are pointing each model to a different datasource. From Teiid's perspective all we see are different datasources - it doesn't matter that they point to same server, etc. If there is a way for a single datasource to access what each of your datasources can access, then you can easily modify your setup to issue a single query. Otherwise you would need some form of materialization or table conformity to populate relevant tables on a single source.
I'm familiar with teiid
but i want to all the queries based on the Same DataBase Server Type and same Serveur : 2 MYSQL databases hosted on my laptop
will be execute as one JDBC query and not seprate JDBC Query