<?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 new vocabulary based on external database ? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/new-vocabulary-based-on-external-database/m-p/313065#M66</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I declared a new data source in my custom bundle which points to an external database :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;extension target="org.nuxeo.runtime.datasource" point="datasources"&amp;gt;
	&amp;lt;datasource name="jdbc/custom" driverClassName="${db.driverClassName}"&amp;gt;
		&amp;lt;property name="url"&amp;gt;${db.url}&amp;lt;/property&amp;gt;
		&amp;lt;property name="user"&amp;gt;${db.username}&amp;lt;/property&amp;gt;
		&amp;lt;property name="password"&amp;gt;${db.password}&amp;lt;/property&amp;gt;
	&amp;lt;/datasource&amp;gt;
&amp;lt;/extension&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I want to know if it is possible to use this data source to add a new read only directory (id - value vocabulary) to my Nuxeo ?&lt;/P&gt;
&lt;P&gt;May be using the SQLDirectoryFactory extension ?&lt;/P&gt;
&lt;P&gt;Regards.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Sep 2022 09:08:14 GMT</pubDate>
    <dc:creator>Ghazi_HAKIM</dc:creator>
    <dc:date>2022-09-27T09:08:14Z</dc:date>
    <item>
      <title>new vocabulary based on external database ?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/new-vocabulary-based-on-external-database/m-p/313065#M66</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I declared a new data source in my custom bundle which points to an external database :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;extension target="org.nuxeo.runtime.datasource" point="datasources"&amp;gt;
	&amp;lt;datasource name="jdbc/custom" driverClassName="${db.driverClassName}"&amp;gt;
		&amp;lt;property name="url"&amp;gt;${db.url}&amp;lt;/property&amp;gt;
		&amp;lt;property name="user"&amp;gt;${db.username}&amp;lt;/property&amp;gt;
		&amp;lt;property name="password"&amp;gt;${db.password}&amp;lt;/property&amp;gt;
	&amp;lt;/datasource&amp;gt;
&amp;lt;/extension&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I want to know if it is possible to use this data source to add a new read only directory (id - value vocabulary) to my Nuxeo ?&lt;/P&gt;
&lt;P&gt;May be using the SQLDirectoryFactory extension ?&lt;/P&gt;
&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 09:08:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/new-vocabulary-based-on-external-database/m-p/313065#M66</guid>
      <dc:creator>Ghazi_HAKIM</dc:creator>
      <dc:date>2022-09-27T09:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: new vocabulary based on external database ?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/new-vocabulary-based-on-external-database/m-p/313066#M67</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I find the solution &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Steps :&lt;/P&gt;
&lt;P&gt;1/ add new datasource pointing to your database&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;extension target="org.nuxeo.runtime.datasource" point="datasources"&amp;gt;
	&amp;lt;datasource name="jdbc/mydb" driverClassName="${db.driverClassName}"&amp;gt;
		&amp;lt;property name="url"&amp;gt;${db.url}&amp;lt;/property&amp;gt;
		&amp;lt;property name="user"&amp;gt;${db.username}&amp;lt;/property&amp;gt;
		&amp;lt;property name="password"&amp;gt;${db.password}&amp;lt;/property&amp;gt;
	&amp;lt;/datasource&amp;gt;
&amp;lt;/extension&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2/ create a VIEW with only columns : id / label / obsolete / ordering based on your table :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;CREATE OR REPLACE FORCE VIEW "XXX"."NUXEO_CAR" ("id", "label", "obsolete", "ordering") AS 
SELECT CAR_ID AS "id", CAR_NAME AS "label", 0 AS "obsolete", 10000000 as "ordering"
FROM CAR_TABLE;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;3/ add new SQLDirectoryFactory&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;extension target="org.nuxeo.ecm.directory.sql.SQLDirectoryFactory" point="directories"&amp;gt;
	&amp;lt;directory name="car"&amp;gt;
		&amp;lt;schema&amp;gt;vocabulary&amp;lt;/schema&amp;gt;
		&amp;lt;dataSource&amp;gt;jdbc/mydb&amp;lt;/dataSource&amp;gt;
		&amp;lt;table&amp;gt;NUXEO_CAR&amp;lt;/table&amp;gt;
		&amp;lt;readOnly&amp;gt;true&amp;lt;/readOnly&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;dataLoadingPolicy&amp;gt;never_load&amp;lt;/dataLoadingPolicy&amp;gt;
	&amp;lt;/directory&amp;gt;
&amp;lt;/extension&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;4/ enjoy your "car" vocabulary &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 09:34:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/new-vocabulary-based-on-external-database/m-p/313066#M67</guid>
      <dc:creator>Ghazi_HAKIM</dc:creator>
      <dc:date>2022-09-28T09:34:16Z</dc:date>
    </item>
  </channel>
</rss>

