Generic Datasource question
m.ardito Jan 15, 2016 7:20 AMHi,
Using standard ODBC (no teiid involved), I can create on each client pc a DSN which does not specify a database (it just has the mysql server address and user/pwd).
Then, from my apps, I can create several connections using that only saved DSN, even if there of course I have to specify a valid db name for the user, on that server.
In this way I can keep a single DSN but reuse it for many different db connections.
I was wondering if, in a similar way, it was possible in Teiid to create a similar "generic" datasource, so that I can then use it in a multisource XML vdb, each time specifying a valid db name for the user, on that server.
Why? If this can work, I can have one single DS for many databases on that server, and just the vdb will know which database it will use on that DS, greatly simplifying the management (I have many databases on that server).
It would work exactly like I am doing on my ODBC app, but through the teiid magic.
I tried and, while I can create the DS like
<datasources>
<datasource jta="false" jndi-name="java:/mysqlserver" pool-name="mysqlserver" enabled="true" use-ccm="false">
<connection-url>jdbc:mysql://192.168.1.1:3306/</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql-connector-java-5.1.22-bin.jar</driver>
<security>
<user-name>user</user-name>
<password>pass</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
</datasources>
and enable it. And I can connect both from the web consele, and from Squirrel .
But if I use it in the vdb with just the jndi name, like
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vdb name="MyVDB" version="1">
<description>Mysql server VDB</description>
<property name="UseConnectorMetadata" value="true" />
<model name="Testmysql">
<property name="importer.useFullSchemaName" value="false"/>
<source name="mysql5-connector" translator-name="mysql5" connection-jndi-name="java:/mysqlserver"/>
</model>
</vdb>
it does not work, the vdb fails loading (as I expected...). I also tried using (guessing) a connection-jndi-name syntax like" java:/mysqlserver/mydb", which does not work either.
Is there a syntax that allows to use such DS in the VDB specifying the database each time?
If not, would it be possible/worth to implement such behaviour?
Marco