I have been trying to connect MySQL via my SQL adapter but I keep getting the following error:
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]
My adapter 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>
Using:
- OS Platform : Mac OSX 10.8
- Eclipse:Kepler Service Release 1
- Worklight: Version 6 Developer Edition
- MySQL: mysql-connector-java-5.1.28-bin.jar 1.6.0_65