Ready to get started?

Learn more about the CData JDBC Driver for Sage 300 or download a free trial:

Download Now

Sage 300Data のPostgreSQL インターフェース

Sage 300 JDBC Driver のRemoting 機能を使用して、データアクセス用のPostgreSQL エントリポイントを作成します。

インターネット上には利用可能な膨大な数のPostgreSQL クライアントがあります。標準のドライバーからBI および分析ツールまで、PostgreSQL はデータアクセスのための人気の高いインタフェースです。 JDBC ドライバーを使用して、標準クライアントから接続できるPostgreSQL エントリポイントを作成することができます。

PostgreSQL データベースとしてSage 300 data にアクセスするには、CData JDBC Driver for Sage 300 とJDBC 外部データラッパー(FDW)を使用します。ここでは、FDW をコンパイルしてインストールし、PostgreSQL サーバーからSage 300 data をクエリします。

JDBC データソースにSage 300 Data を設定

To connect to Sage 300 as a JDBC data source, you will need the following:

  • Driver JAR path: The JAR is located in the lib subfolder of the installation directory.
  • Driver class: cdata.jdbc.sage300.Sage300Driver

  • JDBC URL: The URL must start with "jdbc:sage300:" and can include any of the connection properties in name-value pairs separated with semicolons.

    Sage 300 requires some initial setup in order to communicate over the Sage 300 Web API.

    • Set up the security groups for the Sage 300 user. Give the Sage 300 user access to the option under Security Groups (per each module required).
    • Edit both web.config files in the /Online/Web and /Online/WebApi folders; change the key AllowWebApiAccessForAdmin to true. Restart the webAPI app-pool for the settings to take.
    • Once the user access is configured, click https://server/Sage300WebApi/ to ensure access to the web API.

    Authenticate to Sage 300 using Basic authentication.

    Connect Using Basic Authentication

    You must provide values for the following properties to successfully authenticate to Sage 300. Note that the provider reuses the session opened by Sage 300 using cookies. This means that your credentials are used only on the first request to open the session. After that, cookies returned from Sage 300 are used for authentication.

    • Url: Set this to the url of the server hosting Sage 300. Construct a URL for the Sage 300 Web API as follows: {protocol}://{host-application-path}/v{version}/{tenant}/ For example, http://localhost/Sage300WebApi/v1.0/-/.
    • User: Set this to the username of your account.
    • Password: Set this to the password of your account.

    ビルトイン接続文字列デザイナー

    For assistance in constructing the JDBC URL, use the connection string designer built into the Sage 300 JDBC Driver.Either double-click the JAR file or execute the jar file from the command-line.

    java -jar cdata.jdbc.sage300.jar

    Fill in the connection properties and copy the connection string to the clipboard.

    A typical JDBC URL is below:

    jdbc:sage300:User=SAMPLE;Password=password;URL=http://127.0.0.1/Sage300WebApi/v1/-/;Company=SAMINC;

JDBC Foreign Data Wrapper をビルド

The Foreign Data Wrapper can be installed as an extension to PostgreSQL, without recompiling PostgreSQL.The jdbc2_fdw extension is used as an example.

  1. Add a symlink from the shared object for your version of the JRE to /usr/lib/libjvm.so.For example: ln -s /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server/libjvm.so /usr/lib/libjvm.so
  2. Start the build: make install USE_PGXS=1

Sage 300 Data をPostgreSQL データベースとしてクエリ

After you have installed the extension, follow the steps below to start executing queries to Sage 300 data:

  1. Log into your database.
  2. Load the extension for the database: CREATE EXTENSION jdbc2_fdw;
  3. Create a server object for Sage 300: CREATE SERVER Sage300 FOREIGN DATA WRAPPER jdbc2_fdw OPTIONS ( drivername 'cdata.jdbc.sage300.Sage300Driver', url 'jdbc:sage300:User=SAMPLE;Password=password;URL=http://127.0.0.1/Sage300WebApi/v1/-/;Company=SAMINC;', querytimeout '15', jarfile '/home/MyUser/CData/CData\ JDBC\ Driver\ for\ Salesforce MyDriverEdition/lib/cdata.jdbc.sage300.jar');
  4. Create a user mapping for the username and password of a user known to the MySQL daemon. CREATE USER MAPPING for postgres SERVER Sage300 OPTIONS ( username 'admin', password 'test');
  5. Create a foreign table in your local database: postgres=# CREATE FOREIGN TABLE oeinvoices ( oeinvoices_id text, oeinvoices_InvoiceUniquifier text, oeinvoices_ApprovedLimit numeric) SERVER Sage300 OPTIONS ( table_name 'oeinvoices');
You can now execute SELECT commands to Sage 300: postgres=# SELECT * FROM oeinvoices;
 
 
ダウンロード