MyCATApache / Mycat-Server

GNU General Public License v2.0
9.51k stars 3.85k forks source link

Mycat 1.6.5同时连接my sql和sql server遇到问题 #1597

Open Fire1nRain opened 7 years ago

Fire1nRain commented 7 years ago

RT,因为业务需求,需要让mycat 在连接MySQL的同时挂一个SQL server。 捣鼓了大半天之后成功连接。没有报错,然而从昨天开始,MyCat一直在报同一个错误: 2017-08-01 18:37:32.922 WARN [BusinessExecutor8] (io.mycat.backend.mysql.nio.handler.MultiNodeHandler.errorResponse(MultiNodeHandler.java:137)) - error response from JDBCConnection [id=59,autocommit=true,pool=io.mycat.backend.jdbc.JDBCDatasource@37c12f4a, schema=hotpdmall_xingzhuang, dbType=SQLSERVER, oldSchema=hotpdmall_xingzhuang, packetId=1, txIsolation=0, running=false, borrowed=false, host=null, port=-1, con=net.sourceforge.jtds.jdbc.JtdsConnection@893e1eb, respHandler=null, attachement=null, headerOutputed=false, modifiedSQLExecuted=false, startTime=1501583485453, lastTime=1501583852912, isSpark=false, processor=io.mycat.net.NIOProcessor@5e320bb] err 必须声明标量变量 "@@session"。 code:137 2017-08-01 18:37:32.923 INFO [$_NIOREACTOR-14-RW] (io.mycat.net.AbstractConnection.close(AbstractConnection.java:510)) - close connection,reason:stream closed ,ServerConnection [id=39, schema=js, host=192.168.0.36, user=root,txIsolation=3, autocommit=true, schema=js] 2017-08-01 18:37:33.861 INFO [$_NIOREACTOR-15-RW] (io.mycat.net.handler.FrontendAuthenticator.success(FrontendAuthenticator.java:226)) - ServerConnection [id=40, schema=js, host=192.168.0.36, user=root,txIsolation=3, autocommit=true, schema=js]'root' login success 我的schema.xml里面关于SQL server的配置: <table name="userbasic" dataNode="dn101" type="global" needAddLimit="false"/>

<dataNode name="dn101" dataHost="sqlserver" database="test" />

`<dataHost name="sqlserver" maxCon="1000" minCon="100" balance="0" writeType="0" dbType="sqlserver" dbDriver="jdbc" switchType="1" slaveThreshold="100">

select 1
            <writeHost host="hostM3" url="jdbc:jtds:sqlserver://192.168.0.201:1433" user="sa" password="123456"/>
    </dataHost>

` 其中数据库的链接url是从网上找来的,然后还去下了个jtds的jar包放到了mycat的lib文件夹下才能正常访问SQLserver。 请问有人知道什么原因么??

chenyuegu commented 7 years ago

请问您解决了么,我也遇到了这个问题

jiaZengShen commented 6 years ago

我也遇到了这个问题