我用的ibatisnet版本分别是(dataaccess1.9.2,datamapper1.6.2),连接mysql时报错:Unable to open connection to "MySQL, ByteFx provider V0.7.6.15073".未处理 IBatisNet.DataMapper.Exceptions.DataMapperException
Message="Unable to open connection to \"MySQL, ByteFx provider V0.7.6.15073\"."
Source="IBatisNet.DataMapper"
StackTrace:
在 IBatisNet.DataMapper.SqlMapSession.OpenConnection(String connectionString)
在 IBatisNet.DataMapper.SqlMapSession.OpenConnection()
在 IBatisNet.DataMapper.SqlMapper.OpenConnection()
在 MicroManager.Ibatis.Dao.UserDaoImpl.InsertUser(User user) 位置 D:\project_cs\MicroManager\MicroManager\src\Ibatis\Dao\UserDaoImpl.cs:行号 26
在 MicroManager.Program.Main() 位置 D:\project_cs\MicroManager\MicroManager\src\Program.cs:行号 30
在 System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()请问这是什么问题啊?????我的配置如下:
SqlMap.config<?xml version="1.0" encoding="utf-8"?>
<sqlMapConfig xmlns="http://ibatis.apache.org/dataMapper" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <settings>
<setting useStatementNamespaces="false"/>
</settings> <providers resource="providers.config"/> <database>
<provider name="ByteFx" />
<dataSource name="micro_manager"
connectionString="Host=localhost;Database=micro_manager;
Password=123456;Username=root" />
</database> <sqlMaps>
<sqlMap resource="User.xml"/>
</sqlMaps>
</sqlMapConfig>
模板:user.xml
<?xml version="1.0" encoding="UTF-8" ?>
<sqlMap namespace="User" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <alias>
<typeAlias alias="User" type="MicroManager.Ibatis.Domain.User, MicroManager" />
</alias> <!-- =============================================
MAPPED STATEMENTS
=============================================
-->
<resultMaps>
<resultMap id="SelectAllResult" class="User">
<result property="UserId" column="user_id" />
<result property="UserName" column="user_name" />
<result property="UserPassword" column="user_password" />
<result property="UserRole" column="user_role" />
<result property="UserDate" column="user_date" />
</resultMap>
</resultMaps> <statements> <insert id="InsertUser" parameterClass="User">
Insert Into user
(user_id, user_name, user_password, user_role, user_date)
Values
(#UserId#, #UserName#, #UserPassword#, #UserRole#, #UserDate#)
</insert> <select id ="SelcetAllUser">
Select * from user
</select> </statements></sqlMap>
Message="Unable to open connection to \"MySQL, ByteFx provider V0.7.6.15073\"."
Source="IBatisNet.DataMapper"
StackTrace:
在 IBatisNet.DataMapper.SqlMapSession.OpenConnection(String connectionString)
在 IBatisNet.DataMapper.SqlMapSession.OpenConnection()
在 IBatisNet.DataMapper.SqlMapper.OpenConnection()
在 MicroManager.Ibatis.Dao.UserDaoImpl.InsertUser(User user) 位置 D:\project_cs\MicroManager\MicroManager\src\Ibatis\Dao\UserDaoImpl.cs:行号 26
在 MicroManager.Program.Main() 位置 D:\project_cs\MicroManager\MicroManager\src\Program.cs:行号 30
在 System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()请问这是什么问题啊?????我的配置如下:
SqlMap.config<?xml version="1.0" encoding="utf-8"?>
<sqlMapConfig xmlns="http://ibatis.apache.org/dataMapper" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <settings>
<setting useStatementNamespaces="false"/>
</settings> <providers resource="providers.config"/> <database>
<provider name="ByteFx" />
<dataSource name="micro_manager"
connectionString="Host=localhost;Database=micro_manager;
Password=123456;Username=root" />
</database> <sqlMaps>
<sqlMap resource="User.xml"/>
</sqlMaps>
</sqlMapConfig>
模板:user.xml
<?xml version="1.0" encoding="UTF-8" ?>
<sqlMap namespace="User" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <alias>
<typeAlias alias="User" type="MicroManager.Ibatis.Domain.User, MicroManager" />
</alias> <!-- =============================================
MAPPED STATEMENTS
=============================================
-->
<resultMaps>
<resultMap id="SelectAllResult" class="User">
<result property="UserId" column="user_id" />
<result property="UserName" column="user_name" />
<result property="UserPassword" column="user_password" />
<result property="UserRole" column="user_role" />
<result property="UserDate" column="user_date" />
</resultMap>
</resultMaps> <statements> <insert id="InsertUser" parameterClass="User">
Insert Into user
(user_id, user_name, user_password, user_role, user_date)
Values
(#UserId#, #UserName#, #UserPassword#, #UserRole#, #UserDate#)
</insert> <select id ="SelcetAllUser">
Select * from user
</select> </statements></sqlMap>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货