流量:
<db:generic-config name="MS_SQL_DB" url="jdbc:jtds:sqlserver://host:1433/myCRM_0813;instance=MYINST;username=sa;password=sa" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" doc:name="Generic Database Configuration"/>
<flow name="msconnFlow1" doc:name="msconnFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="${hostname}" port="${sfdcport}" path="msconnect" doc:name="HTTP"/>
<logger message="test---------" level="INFO" doc:name="Logger"/>
<db:select config-ref="MS_SQL_DB" doc:name="Database">
<db:parameterized-query><![CDATA[select * from Account]]></db:parameterized-query>
</db:select>
<logger message="==done===" level="INFO" doc:name="Logger"/>
</flow>
异常:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Started app 'test' +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2015-06-03 11:59:31,664 [[test].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: test---------
ERROR 2015-06-03 11:59:31,728 [[test].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : null (java.lang.NullPointerException). Message payload is of type: String
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. null (java.lang.NullPointerException)
org.mule.module.db.internal.domain.connection.DefaultDbConnection:99 (null)
2. null (java.lang.NullPointerException). Message payload is of type: String (org.mule.api.MessagingException)
org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.NullPointerException
at org.mule.module.db.internal.domain.connection.DefaultDbConnection.isClosed(DefaultDbConnection.java:99)
at org.mule.module.db.internal.domain.connection.TransactionalDbConnectionFactory.releaseConnection(TransactionalDbConnectionFactory.java:150)
at org.mule.module.db.internal.processor.AbstractDbMessageProcessor.process(AbstractDbMessageProcessor.java:87)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
注意:我可以使用jdbc运行相同的查询,我通过studio的测试连接显示连接成功。
答案 0 :(得分:1)
有端口问题,最后给端口号
JDBC:SQLSERVER://主机:49389;实例= MYINST;用户名= SA;密码= SA
答案 1 :(得分:0)
使用下面的driverClassName:
<强> net.sourceforge.jtds.jdbc.Driver 强>
数据库网址:
<强> JDBC:JTDS:SQLSERVER://服务器:端口/数据库强>
答案 2 :(得分:0)
这是我以前用MSSql服务器配置的方式: -
<db:generic-config name="Generic_Database_Configuration"
url="jdbc:sqlserver://ANIRBAN-PC\\SQLEXPRESS:1433;databaseName=MyDBName;user=sa;password=mypassword"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" doc:name="Generic Database Configuration" />
然后: -
<db:select config-ref="Generic_Database_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[select * from table1]]></db:parameterized-query>
</db:select>
它成功运作...... MuleSoft and SQL Server DB connection failure
你可以尝试相同的