<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to declare a jdbc used by a vocabulary in Studio ? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-declare-a-jdbc-used-by-a-vocabulary-in-studio/m-p/313663#M664</link>
    <description>&lt;P&gt;In studio, it seems impossible to declare a custom vocabulary (not based on the single data source).&lt;/P&gt;
&lt;P&gt;So I choose an arbitrary vocabulary and give in custom properties my &lt;EM&gt;directoryName&lt;/EM&gt; (test)&lt;/P&gt;
&lt;P&gt;The bundle is generated as expected&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;properties widgetMode="edit"&amp;gt;
      &amp;lt;property name="directoryName"&amp;gt;test&amp;lt;/property&amp;gt;
    &amp;lt;/properties&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and in studio i even have "Directory Name" positionned to "test" (as if it was a studio vocabulary).&lt;/P&gt;
&lt;P&gt;That's a real dirty solution !&lt;/P&gt;
&lt;P&gt;I also declared an XML extension in studio for my directory :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;extension point="directories" target="org.nuxeo.ecm.directory.sql.SQLDirectoryFactory"&amp;gt;
    &amp;lt;directory name="test"&amp;gt;
      &amp;lt;schema&amp;gt;vocabulary&amp;lt;/schema&amp;gt;
      &amp;lt;dataSource&amp;gt;XXXXX&amp;lt;/dataSource&amp;gt;
      &amp;lt;cacheTimeout&amp;gt;3600&amp;lt;/cacheTimeout&amp;gt;
      &amp;lt;cacheMaxSize&amp;gt;1000&amp;lt;/cacheMaxSize&amp;gt;
      &amp;lt;table&amp;gt;test&amp;lt;/table&amp;gt;
      &amp;lt;idField&amp;gt;id&amp;lt;/idField&amp;gt;
      &amp;lt;autoincrementIdField&amp;gt;false&amp;lt;/autoincrementIdField&amp;gt;
      &amp;lt;createTablePolicy&amp;gt;never&amp;lt;/createTablePolicy&amp;gt;
    &amp;lt;/directory&amp;gt;
  &amp;lt;/extension&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;First question : what's the syntax of the datasource element :&lt;/P&gt;
&lt;P&gt;a studio vocabulary would be defined as &lt;EM&gt;java:/test&lt;/EM&gt; whereas, according to common contributions to the org.nuxeo.ecm.directory.sql.SQLDirectoryFactory directories extension point, it would be &lt;EM&gt;jdbc/test&lt;/EM&gt;. What's the difference ?&lt;/P&gt;
&lt;P&gt;Server side : I tried to declare the mentionned jdbc ressource.&lt;/P&gt;
&lt;P&gt;I copied common-base to a custom template&lt;/P&gt;
&lt;P&gt;it is deployed after common-base&lt;/P&gt;
&lt;P&gt;in server.xml template, I declared a second ressource next to the common datasource :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Resource name="jdbc/testDS" auth="Container" type="javax.sql.DataSource"
    maxActive="5" maxIdle="30" maxWait="10000" driverClassName="${nuxeo.test.driver}"
    url="${nuxeo.test.jdbc.url}" validationQuery=""
    username="${nuxeo.test.user}" password="${nuxeo.test.password}"
    accessToUnderlyingConnectionAllowed="true" /&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In nuxeo.xml template, I delared the ressource link pointing to the global ressource&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;ResourceLink name="jdbc/test" global="jdbc/testDS" type="javax.sql.DataSource" /&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Finally, I excluded both ressource names from the common datasource in nuxeo.conf&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;singleDataSource.exclude=jdbc/testDS,jdbc/test
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When using the widget, I get the following error :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Caused by: **org.postgresql.util.PSQLException**: ERREUR: la relation « test » n'existe pas
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What would be the proper declaration(s) for my directory to work with the data source I declared ?&lt;/P&gt;</description>
    <pubDate>Tue, 21 Apr 2015 15:19:02 GMT</pubDate>
    <dc:creator>pibou_Bouvret</dc:creator>
    <dc:date>2015-04-21T15:19:02Z</dc:date>
    <item>
      <title>How to declare a jdbc used by a vocabulary in Studio ?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-declare-a-jdbc-used-by-a-vocabulary-in-studio/m-p/313663#M664</link>
      <description>&lt;P&gt;In studio, it seems impossible to declare a custom vocabulary (not based on the single data source).&lt;/P&gt;
&lt;P&gt;So I choose an arbitrary vocabulary and give in custom properties my &lt;EM&gt;directoryName&lt;/EM&gt; (test)&lt;/P&gt;
&lt;P&gt;The bundle is generated as expected&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;properties widgetMode="edit"&amp;gt;
      &amp;lt;property name="directoryName"&amp;gt;test&amp;lt;/property&amp;gt;
    &amp;lt;/properties&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and in studio i even have "Directory Name" positionned to "test" (as if it was a studio vocabulary).&lt;/P&gt;
&lt;P&gt;That's a real dirty solution !&lt;/P&gt;
&lt;P&gt;I also declared an XML extension in studio for my directory :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;extension point="directories" target="org.nuxeo.ecm.directory.sql.SQLDirectoryFactory"&amp;gt;
    &amp;lt;directory name="test"&amp;gt;
      &amp;lt;schema&amp;gt;vocabulary&amp;lt;/schema&amp;gt;
      &amp;lt;dataSource&amp;gt;XXXXX&amp;lt;/dataSource&amp;gt;
      &amp;lt;cacheTimeout&amp;gt;3600&amp;lt;/cacheTimeout&amp;gt;
      &amp;lt;cacheMaxSize&amp;gt;1000&amp;lt;/cacheMaxSize&amp;gt;
      &amp;lt;table&amp;gt;test&amp;lt;/table&amp;gt;
      &amp;lt;idField&amp;gt;id&amp;lt;/idField&amp;gt;
      &amp;lt;autoincrementIdField&amp;gt;false&amp;lt;/autoincrementIdField&amp;gt;
      &amp;lt;createTablePolicy&amp;gt;never&amp;lt;/createTablePolicy&amp;gt;
    &amp;lt;/directory&amp;gt;
  &amp;lt;/extension&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;First question : what's the syntax of the datasource element :&lt;/P&gt;
&lt;P&gt;a studio vocabulary would be defined as &lt;EM&gt;java:/test&lt;/EM&gt; whereas, according to common contributions to the org.nuxeo.ecm.directory.sql.SQLDirectoryFactory directories extension point, it would be &lt;EM&gt;jdbc/test&lt;/EM&gt;. What's the difference ?&lt;/P&gt;
&lt;P&gt;Server side : I tried to declare the mentionned jdbc ressource.&lt;/P&gt;
&lt;P&gt;I copied common-base to a custom template&lt;/P&gt;
&lt;P&gt;it is deployed after common-base&lt;/P&gt;
&lt;P&gt;in server.xml template, I declared a second ressource next to the common datasource :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Resource name="jdbc/testDS" auth="Container" type="javax.sql.DataSource"
    maxActive="5" maxIdle="30" maxWait="10000" driverClassName="${nuxeo.test.driver}"
    url="${nuxeo.test.jdbc.url}" validationQuery=""
    username="${nuxeo.test.user}" password="${nuxeo.test.password}"
    accessToUnderlyingConnectionAllowed="true" /&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In nuxeo.xml template, I delared the ressource link pointing to the global ressource&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;ResourceLink name="jdbc/test" global="jdbc/testDS" type="javax.sql.DataSource" /&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Finally, I excluded both ressource names from the common datasource in nuxeo.conf&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;singleDataSource.exclude=jdbc/testDS,jdbc/test
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When using the widget, I get the following error :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Caused by: **org.postgresql.util.PSQLException**: ERREUR: la relation « test » n'existe pas
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What would be the proper declaration(s) for my directory to work with the data source I declared ?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2015 15:19:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-declare-a-jdbc-used-by-a-vocabulary-in-studio/m-p/313663#M664</guid>
      <dc:creator>pibou_Bouvret</dc:creator>
      <dc:date>2015-04-21T15:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to declare a jdbc used by a vocabulary in Studio ?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-declare-a-jdbc-used-by-a-vocabulary-in-studio/m-p/313664#M665</link>
      <description>&lt;P&gt;The solution is to simply create a contribution extending the "datasources" extension point of "org.nuxeo.runtime.datasource"&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2016 11:04:44 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-declare-a-jdbc-used-by-a-vocabulary-in-studio/m-p/313664#M665</guid>
      <dc:creator>pibou_Bouvret</dc:creator>
      <dc:date>2016-03-01T11:04:44Z</dc:date>
    </item>
  </channel>
</rss>

