我開始使用適配器,我可以在Android模擬器中運行我的應用程序,但在我的Android平板電腦設備中失敗。工作燈SQL適配器部署
我試着在應用descriptor.xml localhost來改變172.16.19.135:8080但它仍然失敗,此錯誤消息:
"Request timeout for [http://172.16.19.135:8080/apps/services/api/PrototypesDojo/android/query]"
在我的工作燈的項目我在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" />
連接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以驗證連接。
設備是否連接到與Worklight Server相同的網絡? – 2013-04-10 14:48:03
不是,我的平板電腦已連接到Wi-Fi,並且我的本地計算機已連接到局域網... – 2013-04-10 15:10:14
那將是您的問題,然後...如果172.16.19.135無法在您的本地網絡之外訪問,則不存在讓您的設備連接到您的worklight服務器。這也是您能夠在模擬器上連接到它的原因。 – jnortey 2013-04-10 18:24:36