我开始使用适配器,我可以在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