簡體   English   中英

在 pentaho 水壺中的轉換之間共享數據庫連接

[英]Share Database connections across transformations in pentaho kettle

我想共享用於跨其他轉換的轉換的數據庫連接。

Pentaho Kettle 有可能嗎? 如果是,那么如何?

如果不是,除了再次手動定義所有數據庫連接之外,是否還有其他解決方法?

多年前我在 pentaho 網站的某個地方找到了這個解決方案,我仍然在使用它。 對於共享數據庫連接,我使用目錄 ~/.kettle(在我的 HOME 目錄中)中名為 shared.xml 的文件。 寫入/更改文件后,您必須重新啟動 pentaho。 之后,您可以在轉換中按 shared.xml 中定義的名稱選擇數據庫連接。

這是一個具有一些基本屬性的示例。 我用它作為模板。

<?xml version="1.0" encoding="UTF-8"?>
<sharedobjects>
  <connection>
    <name>name</name>
    <server>server</server> 
    <type>type</type> 
    <access>Native</access>
    <database>database</database>
    <port>1234</port>
    <username>username</username>
    <password>Encrypted ....</password>
    <servername/>
    <data_tablespace/>
    <index_tablespace/>
    <attributes>
      <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
      <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
      <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>Y</attribute></attribute>
      <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
      <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
      <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
      <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
      <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  </attributes>
 </connection>   </sharedobjects>

簡短說明:

name = choose a name you can identify your database... 
server = localhost or IP address or FQDN
type = POSTGRESQL, MYSQL ... database type
database = the real database name used with CREATE ...
username = must be a known user to the database

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM