ibatis框架下config配置mysql连接问题

caiying_163 2010-07-01 03:47:51
之前在config下配置sqlserver2.0是没有问题的,这次用到的数据库是mysql,在配置是老出现错误,在修改配置时我大体修改的如下几步
1、providers.config下把之前的sqlserver2.0下enabled和default移植到mysql下,sqlserver2.0的enabled改成false
2、
<database>
<!--<provider name="sqlServer2.0"/>-->
<!--<dataSource name="FTHBJ-TEST" connectionString="Data Source=cy;Initial Catalog=FTHBJ-TEST;Persist Security Info=True;User ID=sa;password=123456;"/>-->
<provider name="MySql"/>
<dataSource name="fthbj" connectionString="Server=localhost;User Id=root;Password=123456;Persist Security Info=True;Database=fthbj"/>
</database>
但运行时服务端提示:
************** 异常文本 **************
System.Exception: 服务器端执行模糊查询语句时发现以下错误:
XML文件可能不正确,附加信息如下:

- The error occurred while loading Providers.
- initialize provider
- Check the MySql. ---> System.Exception: XML文件可能不正确,附加信息如下:

- The error occurred while loading Providers.
- initialize provider
- Check the MySql.
在 iBatis.Implement.DBService.Mapper.InitMapper() 位置 D:\c#\ibatis_mysql\iBatis.Server\iBatis.Implement\DBService\Mapper.cs:行号 44
在 iBatis.Implement.DBService.Mapper.Instance() 位置 D:\c#\ibatis_mysql\iBatis.Server\iBatis.Implement\DBService\Mapper.cs:行号 60
在 iBatis.Implement.DBService.DBInterface`1.QueryObject[U](U queryObject) 位置 D:\c#\ibatis_mysql\iBatis.Server\iBatis.Implement\DBService\DBInterface.cs:行号 744
--- 内部异常堆栈跟踪的结尾 ---

Server stack trace:
在 iBatis.Implement.DBService.DBInterface`1.QueryObject[U](U queryObject) 位置 D:\c#\ibatis_mysql\iBatis.Server\iBatis.Implement\DBService\DBInterface.cs:行号 752
在 System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
在 System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
在 System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
在 iBatis.Core.DBFunction.IDBInterface`1.QueryObject[U](U queryObject)
在 iBatis.Client.Common.frmOrderList.ShowData() 位置 D:\c#\ibatis_mysql\iBatis.Server\iBatis.Client\Common\frmOrderList.cs:行号 44
在 iBatis.Client.Common.frmOrderList.frmOrderList_Load(Object sender, EventArgs e) 位置 D:\c#\ibatis_mysql\iBatis.Server\iBatis.Client\Common\frmOrderList.cs:行号 106
在 System.Windows.Forms.Form.OnLoad(EventArgs e)
在 System.Windows.Forms.Form.OnCreateControl()
在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
在 System.Windows.Forms.Control.CreateControl()
在 System.Windows.Forms.Control.WmShowWindow(Message& m)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
在 System.Windows.Forms.ContainerControl.WndProc(Message& m)
在 System.Windows.Forms.Form.WmShowWindow(Message& m)
在 System.Windows.Forms.Form.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


我的providers.config下mysql的配置:
<provider
name="MySql"
description="MySQL, MySQL provider 1.0.7.30072"
enabled="true"
default="true"
assemblyName="MySql.Data, Version=1.0.7.30072, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionClass="MySql.Data.MySqlClient.MySqlConnection"
commandClass="MySql.Data.MySqlClient.MySqlCommand"
parameterClass="MySql.Data.MySqlClient.MySqlParameter"
parameterDbTypeClass="MySql.Data.MySqlClient.MySqlDbType"
parameterDbTypeProperty="MySqlDbType"
dataAdapterClass="MySql.Data.MySqlClient.MySqlDataAdapter"
commandBuilderClass="MySql.Data.MySqlClient.MySqlCommandBuilder"
usePositionalParameters="false"
useParameterPrefixInSql="true"
useParameterPrefixInParameter="true"
parameterPrefix="?"
allowMARS="false"
/>

app.config下的remoting
<system.runtime.remoting>
<application>
<channels>
<channel ref="Tcp" port="8080" />
</channels>
<service>
<!-- 以下为公共 -->
<wellknown mode="Singleton" type="iBatis.Implement.Function.Common.Currency,iBatis.Implement" objectUri="Currency.rem" />
</service>
</application>
</system.runtime.remoting>

哪位朋友知道应该怎么改,不慎感激啊。。。。。。
...全文
744 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
KissZjs 2011-09-23
  • 打赏
  • 举报
回复
http://blog.sina.com.cn/s/blog_71b9f1d10100u0qe.html,我配置时的一些步骤,楼主可以看看
caiying_163 2010-07-01
  • 打赏
  • 举报
回复
那你们谁用过ibatis连接过mysql的?我单独加分
caiying_163 2010-07-01
  • 打赏
  • 举报
回复
我怕描述不详细您们看不明白
guyehanxinlei 2010-07-01
  • 打赏
  • 举报
回复
友情帮顶!
LovingAlison 2010-07-01
  • 打赏
  • 举报
回复
你完全可以经典下问题 大家更愿意看简洁的问题 你也可以更快得到答案
LovingAlison 2010-07-01
  • 打赏
  • 举报
回复


Standard
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Default port is 3306.

Specifying port
Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Download the driver at MySQL Developer Zone

Named pipes
Server=myServerAddress;Port=-1;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
It is the port value of -1 that tells the driver to use named pipes network protocol. This is available on Windows only. The value is ignored if Unix socket is used.

Multiple servers
Use this to connect to a server in a replicated server configuration without concern on which server to use.
Server=serverAddress1 & serverAddress2 & etc..;Database=myDataBase;Uid=myUsername;Pwd=myPassword;


Using encryption
This one activates SSL encryption for all data sent between the client and server. The server needs to have a certificate installed.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Encryption=true;
This option is available from Connector/NET version 5.0.3. In earlier versions, this option has no effect.

Using encryption, alternative
Some reported problems with the above one. Try replacing the key "Encryption" with "Encrypt" instead.
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Encrypt=true;
mayonglong 2010-07-01
  • 打赏
  • 举报
回复
不了解,帮顶~~~

110,499

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧