mysql - IBM Worklight - "Could not connect to database"错误消息

标签 mysql macos ibm-mobilefirst worklight-adapters

我一直在尝试通过我的 SQL 适配器连接 MySQL,但我不断收到以下错误:

Could not connect to database. Cannot create PoolableConnectionFactory (Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.). [project SampleWorklightApp]

我的适配器 XML:

<?xml version="1.0" encoding="UTF-8"?>
<wl:adapter name="sampleSQLAdapter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:wl="http://www.worklight.com/integration" xmlns:sql="http://www.worklight.com/integration/sql">

  <displayName>sampleSQLAdapter</displayName>
  <description>sampleSQLAdapter</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://127.0.0.1:3306/test</url>
        <user>root</user>
        <password>sanchit</password>
      </dataSourceDefinition>
    </connectionPolicy>
    <loadConstraints maxConcurrentConnectionsPerNode="5" />
  </connectivity>

  <!-- Replace this with appropriate procedures -->
  <procedure name="getCustomerName" />
  <procedure name="insertCustomerDetails" />
</wl:adapter>

使用:

  • 操作系统平台:Mac OSX 10.8
  • Eclipse:Kepler 服务版本 1
  • Worklight:版本 6 开发人员版
  • MySQL:mysql-connector-java-5.1.28-bin.jar 1.6.0_65

最佳答案

看看下面的内容是否有帮助:

  1. 尝试使用“localhost”而不是“127.0.0.1”。

    当您连接到“localhost”时,使用套接字连接器,但当您连接到“127.0.0.1”时,使用 TCP/IP 连接器 (source)。

    从问题中的错误消息来看,TCP/IP 连接似乎存在一些问题...因此也请尝试使用“localhost”。

  2. 根据问题中评论讨论中粘贴的信息,您可以尝试这些解决方案:

关于mysql - IBM Worklight - "Could not connect to database"错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20837404/

相关文章:

android - Worklight 6.2 Android 应用程序未在推送通知时启动

macos - 将 Mac OSX etc/hosts 上的域映射更改为 Vagrant 虚拟机

oracle - Worklight 间歇性地抛出 ORA-12516

php - 在 CodeIgniter 中设置状态

mysql - 四舍五入到 0.5 SQL

swift - 将数据的排序列表保存到核心数据中

macos - Apache 和 passenger 在 Docker mac 和 ubuntu 上的行为不同

ios - IBM Worklight - 如何将条形码扫描仪phonegap 插件添加到 Xcode 5 中的 config.xml 中?

mysql - 使用 Oracle Devloper 的 Scratch Pad 将 MySQL 转换为 PL/SQL 的选项去哪儿了?

干净的系统重新启动后 mySQL InnoDB 表损坏