带有数据库的worklight应用程序无法在真正的Android移动设备中运行

时间:2022-04-21 22:14:42

I have developed a hybrid application in Ibm worklight using jquerymobile framework. The application accesses database hosted on my own domain using sqladapter. It works fine on Ibm worklight console as well as on AVD. But when I tried to run the application from real android phone, it won't work.I tried to access the database but it does not work in real android device. I saw some solutions that i should connect to worklight server from my device and how is it possible? What steps to be followed further? Help me, i am new to this course.

我使用jquerymobile框架在Ibm worklight中开发了一个混合应用程序。应用程序使用sqladapter访问我自己的域上托管的数据库。它在Ibm worklight控制台以及AVD上都能正常工作。但是当我试图从真正的Android手机运行应用程序时,它将无法正常工作。我试图访问数据库,但它在真正的Android设备中不起作用。我看到一些解决方案,我应该从我的设备连接到worklight服务器,它是如何可能的?需要采取哪些措施?帮助我,我是这门课程的新手。

1 个解决方案

#1


When testing in a device you need to make sure the following:

在设备中进行测试时,您需要确保以下内容:

  1. The device is connected to the same WiFi network as the computer that hosts the Worklight Server
  2. 设备连接到与承载Worklight Server的计算机相同的WiFi网络

  3. The SQL adapter connectionPolicy points to the IP address of the computer that hosts the Worklight Server.

    SQL适配器connectionPolicy指向承载Worklight Server的计算机的IP地址。

    Change "localhost" to an IP address:

    将“localhost”更改为IP地址:

    <connectionPolicy xsi:type="sql:SQLConnectionPolicy">
        <dataSourceDefinition>
            <driverClass>com.mysql.jdbc.Driver</driverClass>
            <url>jdbc:mysql://localhost:3306/mydb</url>
            <user>myUsername</user>
            <password>myPassword</password> 
       </dataSourceDefinition>
    </connectionPolicy>
    

#1


When testing in a device you need to make sure the following:

在设备中进行测试时,您需要确保以下内容:

  1. The device is connected to the same WiFi network as the computer that hosts the Worklight Server
  2. 设备连接到与承载Worklight Server的计算机相同的WiFi网络

  3. The SQL adapter connectionPolicy points to the IP address of the computer that hosts the Worklight Server.

    SQL适配器connectionPolicy指向承载Worklight Server的计算机的IP地址。

    Change "localhost" to an IP address:

    将“localhost”更改为IP地址:

    <connectionPolicy xsi:type="sql:SQLConnectionPolicy">
        <dataSourceDefinition>
            <driverClass>com.mysql.jdbc.Driver</driverClass>
            <url>jdbc:mysql://localhost:3306/mydb</url>
            <user>myUsername</user>
            <password>myPassword</password> 
       </dataSourceDefinition>
    </connectionPolicy>