如何使用mongodb与Android混合应用程序?

时间:2015-05-21 09:51:53

标签: android mongodb ibm-mobilefirst

如何在ibm worklight中使用mongodb和android hybrid app build?

如何在Android应用程序中实现mongodb? 如何在mongodb网站上设置?

我需要远程连接吗? mongodb的:// [DBUSER:DBPASS @]主机:端口[/ DBNAME] 如果是的话什么是主机:Android应用程序的端口?

我在IBM WORKLIGHT中需要HTTP ADAPTER吗? 如果是,那么如何设置?

对于非云或离线模式,它已由SQL ADAPTER完成 现在我想要基于云或基于网络。

带有IBM DB2数据库的IBM WORKLIGHT SQL ADAPTER

<wl:adapter name="SQL_ADAPTER_Yummy"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:wl="http://www.worklight.com/integration"
xmlns:sql="http://www.worklight.com/integration/sql">

<displayName>SQL_ADAPTER_Yummy</displayName>
<description>SQL_ADAPTER_Yummy</description>
<connectivity>
    <connectionPolicy xsi:type="sql:SQLConnectionPolicy">
        <!-- Example for using a JNDI data source, replace with actual data source name -->
        <!-- <dataSourceJNDIName>java:/data-source-jndi-name</dataSourceJNDIName> -->

        <!-- Example for using MySQL connector, do not forget to put the MySQL connector library in the project's lib folder -->
        <dataSourceDefinition>
            <driverClass>com.ibm.db2.jcc.DB2Driver</driverClass>
            <url>jdbc:db2://localhost:50000/YummyDB</url>
            <user>abc</user>
            <password>123</password> 
        </dataSourceDefinition>
    </connectionPolicy>
    <loadConstraints maxConcurrentConnectionsPerNode="5" />
</connectivity>

<!-- Replace this with appropriate procedures -->
<procedure name="procedure1"/>
<procedure name="procedure2"/>

IBM工作场所的HTTP适配器(示例RSS CNN)

<wl:adapter name="HTTP_ADAPTER_Yummy"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:wl="http://www.worklight.com/integration"
xmlns:http="http://www.worklight.com/integration/http">

<displayName>HTTP_ADAPTER_Yummy</displayName>
<description>HTTP_ADAPTER_Yummy</description>
<connectivity>
    <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
        <protocol>http</protocol>
        <domain>rss.cnn.com</domain>
        <port>80</port> 
        <!-- Following properties used by adapter's key manager for choosing specific certificate from key store  
        <sslCertificateAlias></sslCertificateAlias> 
        <sslCertificatePassword></sslCertificatePassword>
        -->     
    </connectionPolicy>
    <loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>

<procedure name="getStories"/>

<procedure name="getStoriesFiltered"/>

1 个答案:

答案 0 :(得分:0)

见这里:MongoDB on Android

对我而言,这意味着您像任何远程后端一样使用它(即使在这种情况下是数据库),因此您需要使用hTTP适配器