Mysql IBM Worklight-使用IP地址而不是本地主机时无法连接到数据库
我目前正在创建一个Worklight应用程序,从我的计算机的MySQL数据库中检索一些数据 当我尝试运行应用程序时,它无法连接到数据库。当我将数据库的URL更改为IP地址(192.168.6.1(我的计算机的本地主机))时,会发生错误 当我通过调用worklight过程(地址为localhost)从我的计算机上测试它时,它工作正常,但当我将URL更改为IP地址时,它显示一个错误:Mysql IBM Worklight-使用IP地址而不是本地主机时无法连接到数据库,mysql,ibm-mobilefirst,worklight-adapters,Mysql,Ibm Mobilefirst,Worklight Adapters,我目前正在创建一个Worklight应用程序,从我的计算机的MySQL数据库中检索一些数据 当我尝试运行应用程序时,它无法连接到数据库。当我将数据库的URL更改为IP地址(192.168.6.1(我的计算机的本地主机))时,会发生错误 当我通过调用worklight过程(地址为localhost)从我的计算机上测试它时,它工作正常,但当我将URL更改为IP地址时,它显示一个错误: [ERROR ] FWLSE0012E: ERROR: Could not connect to databas
[ERROR ] FWLSE0012E: ERROR: Could not connect to database. Cannot create PoolableConnectionFactory (null, message from server: "Host 'stephen-PC' is not allowed to connect to this MySQL server"). [project BarcodeScannerSample]
[ERROR ] FWLSE0012E: ERROR: Could not connect to database. Cannot create PoolableConnectionFactory (null, message from server: "Host 'stephen-PC' is not allowed to connect to this MySQL server"). [project BarcodeScannerSample]
[ERROR ] FWLSE0012E: ERROR: Could not connect to database. Cannot create PoolableConnectionFactory (null, message from server: "Host 'stephen-PC' is not allowed to connect to this MySQL server"). [project BarcodeScannerSample]
[ERROR ] FWLSE0012E: ERROR: Could not connect to database. Cannot create PoolableConnectionFactory (Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.). [project BarcodeScannerSample]
[ERROR ] FWLSE0012E: ERROR: Could not connect to database. Cannot create PoolableConnectionFactory (Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.). [project BarcodeScannerSample]
[ERROR ] FWLSE0020E: Ajax request exception: There is no application in the DB with the id 'BarcodeScannerSampleApp'. [project BarcodeScannerSample]
[ERROR ] FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request [project BarcodeScannerSample]There is no application in the DB with the id 'BarcodeScannerSampleApp'., User Identity {SubscribeServlet=null, wl_authenticityRealm=null, wl_remoteDisableRealm=null, SampleAppRealm=null, wl_antiXSRFRealm=null, wl_deviceAutoProvisioningRealm=null, WorklightConsole=null, wl_deviceNoProvisioningRealm=null, wl_anonymousUserRealm=null}. [project BarcodeScannerSample]
com.worklight.common.log.filters.ErrorFilter
[ERROR ] FWLSE0012E: ERROR: Could not connect to database. Cannot create PoolableConnectionFactory (null, message from server: "Host 'stephen-PC' is not allowed to connect to this MySQL server"). [project BarcodeScannerSample]
[ERROR ] FWLSE0020E: Ajax request exception: There is no application in the DB with the id 'BarcodeScannerSampleApp'. [project BarcodeScannerSample]
[ERROR ] FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request [project BarcodeScannerSample]There is no application in the DB with the id 'BarcodeScannerSampleApp'., User Identity {SubscribeServlet=null, wl_authenticityRealm=null, wl_remoteDisableRealm=null, SampleAppRealm=null, wl_antiXSRFRealm=null, wl_deviceAutoProvisioningRealm=null, WorklightConsole=null, wl_deviceNoProvisioningRealm=null, wl_anonymousUserRealm=null}. [project BarcodeScannerSample]
com.worklight.common.log.filters.ErrorFilter
[ERROR ] FWLSE0020E: Ajax request exception: There is no application in the DB with the id 'BarcodeScannerSampleApp'. [project BarcodeScannerSample]
[ERROR ] FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request [project BarcodeScannerSample]There is no application in the DB with the id 'BarcodeScannerSampleApp'., User Identity {SubscribeServlet=null, wl_authenticityRealm=null, wl_remoteDisableRealm=null, SampleAppRealm=null, wl_antiXSRFRealm=null, wl_deviceAutoProvisioningRealm=null, WorklightConsole=null, wl_deviceNoProvisioningRealm=null, wl_anonymousUserRealm=null}. [project BarcodeScannerSample]
com.worklight.common.log.filters.ErrorFilter
[ERROR ] FWLSE0020E: Ajax request exception: There is no application in the DB with the id 'BarcodeScannerSampleApp'. [project BarcodeScannerSample]
[ERROR ] FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request [project BarcodeScannerSample]There is no application in the DB with the id 'BarcodeScannerSampleApp'., User Identity {SubscribeServlet=null, wl_authenticityRealm=null, wl_remoteDisableRealm=null, SampleAppRealm=null, wl_antiXSRFRealm=null, wl_deviceAutoProvisioningRealm=null, WorklightConsole=null, wl_deviceNoProvisioningRealm=null, wl_anonymousUserRealm=null}. [project BarcodeScannerSample]
com.worklight.common.log.filters.ErrorFilter
[ERROR ] FWLSE0020E: Ajax request exception: There is no application in the DB with the id 'BarcodeScannerSampleApp'. [project BarcodeScannerSample]
[ERROR ] FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request [project BarcodeScannerSample]There is no application in the DB with the id 'BarcodeScannerSampleApp'., User Identity {SubscribeServlet=null, wl_authenticityRealm=null, wl_remoteDisableRealm=null, SampleAppRealm=null, wl_antiXSRFRealm=null, wl_deviceAutoProvisioningRealm=null, WorklightConsole=null, wl_deviceNoProvisioningRealm=null, wl_anonymousUserRealm=null}. [project BarcodeScannerSample]
com.worklight.common.log.filters.ErrorFilter
[WARNING ] FWLSE0082W: Failed to deploy adapter. This may be due to a JavaScript error in your adapter implementation (archive: 'C:\Users\stephen\AppData\Local\Temp\loginAdapter7158962596204999276.adapter'). [project mywatermelon]
The 'adapter' version '6.1.0.00.20131219-1900' is different than the version of Worklight Server '6.0.0'.
Use Worklight Studio '6.0.0' to build and deploy the application.
[WARNING ] FWLSE0082W: Failed to deploy adapter. This may be due to a JavaScript error in your adapter implementation (archive: 'C:\Users\stephen\AppData\Local\Temp\myRESTAdapter36508485292314915.adapter'). [project mywatermelon]
The 'adapter' version '6.1.0.00.20131219-1900' is different than the version of Worklight Server '6.0.0'.
Use Worklight Studio '6.0.0' to build and deploy the application.
[ERROR ] FWLSE0012E: ERROR: Could not connect to database. Cannot create PoolableConnectionFactory (null, message from server: "Host 'stephen-PC' is not allowed to connect to this MySQL server"). [project BarcodeScannerSample]
以下是适配器XML的连接设置:
<?xml version="1.0" encoding="UTF-8"?>
...
...
<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://192.168.6.1:3306/barcode</url>
<user>root</user>
<password>170693</password>
</dataSourceDefinition>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="5" />
</connectivity>
...
...
</wl:adapter>
...
...
com.mysql.jdbc.Driver
jdbc:mysql://192.168.6.1:3306/barcode
根
170693
...
...
我不知道您使用的是哪个数据库前端,但您需要转到“用户创建/权限”屏幕,确保您已授予用户“root”权限以连接到localhost
和%
(全部),以便IP地址也被接受
例如:root@%
而不是root@localhost
提到这一点
顺便说一句,您可以将其保留为本地主机而不是IP地址(只要您在本地网络中进行测试)。这对设备来说不重要。你试过了吗?对不起,我不知道如何实现。我使用jdbc连接访问mysql数据库,并使用phpmyadmin管理数据库是的,我尝试使用localhost作为IP地址来测试它,但它不起作用,然后您需要找出它。阅读phpmyadmin文档。谷歌快速搜索会发现这个问题。运行谷歌搜索。太好了,在我改变特权后,它终于起作用了。谢谢!