簡體   English   中英

Worklight SQL適配器部署

[英]Worklight SQL Adapter Deployment

我開始使用適配器,並且能夠在Android模擬器中運行我的應用程序,但是在我的Android平板電腦設備中它無法運行。

我試圖將application-descriptor.xml localhost更改為172.16.19.135:8080,但仍然失敗,並顯示以下錯誤消息:

“ [http://172.16.19.135:8080/apps/services/api/PrototypesDojo/android/query的請求超時]”

在我的Worklight項目中,HTML中有一個帶有onClick調用的按鈕。 我稱SQL適配器。

這是我的SQL適配器:

connection.xml

<displayName>connexion</displayName>
<description>connexion</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.mysql.jdbc.Driver</driverClass>
            <url>jdbc:mysql://worklight:3306/test</url>
            <user>root</user>
            <password>myRootPassword</password>
        </dataSourceDefinition>
    </connectionPolicy>
    <loadConstraints maxConcurrentConnectionsPerNode="5" />
</connectivity>

<!-- Replace this with appropriate procedures -->
<procedure name="authentification" />
<procedure name="creerCompte" />

connection-impl.js

var requeteStatement = WL.Server
        .createSQLStatement("select login,password from compte where login = ? and password = ?");


function authentification(login, password) {

    return WL.Server.invokeSQLStatement({
        preparedStatement : requeteStatement,
        parameters : [ login, password ]
    });
}

錯誤:

[http://172.16.19.135:8080/apps/services/api/PrototypesDojo/android/query]主機沒有響應。 嘗試通過android模擬器瀏覽器手動訪問URL以驗證連接性。

這與SQL適配器無關。 此處的實際問題是您無法將設備連接到Worklight Server。

為了使設備連接到Worklight Server,服務器和設備必須共享同一網絡。

在命令窗口中,運行ipconfig並復制給出的IPv4地址。 粘貼此IP地址作為值worklightServerRootURL在文件應用descriptor.xml(位於yourProject \\ APPS \\ yourApp)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM