【问题标题】:IBM Mobilefirst Java Adapter to connect CouchbaseIBM Mobilefirst Java Adapter 连接 Couchbase
【发布时间】:2017-05-03 18:17:37
【问题描述】:

我们可以通过 Mobilefirst 8 Java 或 Javascript SQL 适配器连接到 Couchbase DB 吗?如果可用,请提出替代方案。

【问题讨论】:

  • 问题过于宽泛,请提供更多详细信息 - 您想做什么,您已经尝试过什么?鉴于 Couchbase 不是 SQL 数据库(据我所知,它没有 JDBC 驱动程序),因此 Javascript SQL 适配器在这里帮不了您。
  • 您可以使用 Java 适配器并使用它对 Couchbase DB 进行 REST 调用。
  • Couchbase 服务器有 JDBC 驱动程序。如果您对同步移动数据感兴趣,您还可以查看 Couchbase Mobile 堆栈。

标签: ibm-mobilefirst couchbase mobilefirst-adapters


【解决方案1】:

您可以使用 MFP 8.0 Java 适配器或 Javascript HTTP 适配器并使用它对 Couchbase DB 进行 REST 调用。

【讨论】:

    【解决方案2】:

    是的,可以使用 MFP 8.0 JavaScript 或 Java HTTP 适配器连接任何 NoSQL DB(Couchbase DB),利用 REST 调用。

    这是一个使用 MFP 8.0 JavaScript HTTP 适配器连接到 IBM Cloudant NoSQL DB 的示例。

    AdapterSample.js file -->
    
                  function getDocByKey(key) {
                  var path = '/my_database/'+key;
                  var input = {
                       method : 'get',
                       returnedContentType :'json',
                       path : path
                  };
    
                  return WL.Server.invokeHttp(input);   
    
                  }
    
    adapter.xml file -->
    
    
    <mfp:adapter name="AdapterSample"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:mfp="http://www.ibm.com/mfp/integration"
                 xmlns:http="http://www.ibm.com/mfp/integration/http">
    
        <displayName>AdapterSample</displayName>
        <description>AdapterSample</description>
        <connectivity>
            <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
                <protocol>https</protocol>
                <domain> <-- DB URL here--> </domain>
                <port>443</port>
                <connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
                <socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds>
                <authentication>
                    <basic/>
                    <serverIdentity>
                        <username> <--DB Username here--> </username>
                        <password> <--DB Password here--> </password>
                    </serverIdentity>
                </authentication>
                <maxConcurrentConnectionsPerNode>50</maxConcurrentConnectionsPerNode>
    
            </connectionPolicy>
        </connectivity>
    
        <procedure name="getDocByKey" secured="false"/>
    
    
    </mfp:adapter>
    

    点击这里了解更多信息https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/adapters/

    【讨论】:

      猜你喜欢
      • 2020-12-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-24
      • 1970-01-01
      • 1970-01-01
      • 2023-03-09
      • 1970-01-01
      相关资源
      最近更新 更多