问题
I am trying to connect my adapter to a SQL Server 2012 Express database, but I can't quite get it right. I have downloaded a connector from here: http://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx, and added it to the server\lib
folder in Worklight Studio.
My definitions looks as follows:
<dataSourceDefinition>
<driverClass>com.microsoft.sqlserver.jdbc.SQLServerDriver</driverClass
<url>jdbc:sqlserver://localhost:1433;database=MyDB</url>
<user>MyUser</user>
<password>MyPassword</password>
</dataSourceDefinition>
The driver class seems to be right, but the URL don't. Can anyone point me in the right direction?
PS. My environment is as follows, worklight 6.1, jre7u45, windows 8, SQL Server 2012 Express.
回答1:
Regarding the connection error, see if the following will help:
- http://www.coderanch.com/t/306316/JDBC/databases/SQLServerException-TCP-IP-connection-host
... open SQL Server Configuration Manager -> Protocols for SQL SQLEXPRESS, select Properties of TCP/IP. In the tab IP Addresses, set the TCPPort in section IPAll to 1433
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/bd5bb6c2-a4d9-4071-b2e6-a6c83970b212/commicrosoftsqlserverjdbcsqlserverexception-the-tcpip-connection-to-the-host-has-failed?forum=sqlreportingservices
... note that the JDBC URL structure is different re its use of slashes and backslashes, for example: `jdbc:sqlserver://localhost\SQLEXPRESS/Databases/EPS:1357
来源:https://stackoverflow.com/questions/20654991/ibm-worklight-6-1-failed-connecting-to-ms-sql-using-sql-adapter