-2

How to use mongodb with android hybrid app build in ibm worklight?

How to implement mongodb in android app? How to setup in mongodb website?

Do I need remote connection? mongodb://[dbuser:dbpass@]host:port[/dbname] if yes then what will be host:port for android app?

Do I need HTTP ADAPTER in IBM WORKLIGHT? if yes then how to setup?

For non-cloud or offline mode,it is already done by SQL ADAPTER Now I want cloud based or online based.

IBM WORKLIGHT SQL ADAPTER with IBM DB2 database

<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"/>

HTTP ADAPTER IN IBM WORKLIGHT(SAMPLE 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 Answers1

0

See here: MongoDB on Android

To me it means that you use it like any remote backend (even if a database in this case), and so you'll need to use a hTTP adapter

Community
  • 1
  • 1
Idan Adar
  • 44,156
  • 13
  • 50
  • 89