You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Pieter Baele <pi...@telenet.be> on 2008/04/20 15:48:24 UTC

BATIS (VS2008) looking on the wrong place for SqlMap.config

After some development with Java and iBATIS, we started using  
iBATIS.NET. (for a college university project)

We are programming a webapplication. Structure is as follows:  
Kronos.Web, Kronos.Persistence, Kronos.Domain
and Kronos.Test, in one solution.

I started creating soms basic maps and the config files, but now when  
I try to run a TestMethod,
I get the following error (Mapper.Instance...)

Test method Kronos.Test.MedewerkerTestMap.MedewerkerList threw  
exception:  IBatisNet.Common.Exceptions.ConfigurationException: Unable  
to load file via resource "SqlMap.config" as resource. Cause : Could  
not find file 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE 
\SqlMap.config'. --->  System.IO.FileNotFoundException: Could not find  
file 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE 
\SqlMap.config'.

I want the sqlmaps, configs and maps in one package.... not in Program  
Files/...  ;-)
I am sure this is a small, stupid problem.... iBATIS for Java worked  
without a single problem....

I greatly appreciate any help :-)



Pieter Baele
pieter.baele@telenet.be

VIM has two modes. The one in which it beeps and the one in which it  
doesn't.




Re: BATIS (VS2008) looking on the wrong place for SqlMap.config

Posted by Pieter Baele <pi...@telenet.be>.
Gilles,

Thx, I read the document, but a little too fast I suppose ;-)






Pieter Baele
pieter.baele@telenet.be

"Software is a gas; it expands to fill its container."
– Nathan Myhrvold

On 20 Apr 2008, at 18:31, Gilles Bayon wrote:
> http://ibatis.apache.org/docs/dotnet/datamapper/ch04s04.html
>
>
>
> -- 
> Cheers,
> Gilles


Re: iBATIS looking on the wrong place for SqlMap.config SOLVED

Posted by Pieter Baele <pi...@telenet.be>.
Also solved. Only some small path problems left....

I think I gonna like Java more then .NET/C# ;-)



Pieter Baele
pieter.baele@telenet.be

Experience is a hard teacher because she gives the test first, the  
lesson afterward.

On 21 Apr 2008, at 07:25, Pieter Baele wrote:
> I placed the providers en sqlmap config in bin/debug, then it worked.
> It isn't that straight-forward.....
>
> The only problem left now is that it doesn't find the newest  
> mysql.data library I added myself.
> The bytefx provider is really too old .... 2004 (?!) Or is it still  
> a better option for a mysql db?
>
> I have not changed the publickeytoken, can this cause problems? If  
> so, where do I find this token?
> I tried adding the reference provided by the visual studio  
> integration and also 'the hard way' by providing and
> copying the library. None of the two works :-S
>
> Could not load file or assembly 'MySql.Data, Version=2.0.50727,  
> Culture=neutral' or one of its dependencies.
>
> [code]
> <provider
>    name="MySql"
>    description="MySQL, MySQL provider v2.0.50727"
>    enabled="true"
>    default="true"
>    assemblyName="MySql.Data, Version=2.0.50727, 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"
>  />
> [/code]
>
>
> On 21 Apr 2008, at 01:59, Juan Pablo Araya wrote:
>> You have to put your sqlmap.config in the web root directory, or in
>> bin/debug in the test project.
>>
>> Anyway, you can change the path of your sqlmap.config. See section
>> 4.4.1.2. of the datamapper manual.
>
> Pieter Baele
> pieter.baele@telenet.be
> LinuxUser: #310384
>
> testing? What's that? If it compiles, it is good, if it boots up it is
> perfect.
>
>                        --- Linus Torvalds
>
>
>
>
>
>
>


How to map a read-write property of a readonly object?

Posted by smartkid <sk...@gmail.com>.
Hi,

 

         The IBatis.NET does not support mapping a read-write property of a
readonly object.

 

         public class MyNestedClass {

 

                   private String m_Value;

 

                   public String Value { 

get { return m_Value; } 

set { m_Value = value;}

}

 

}

 

public class MyClass {

 

         private MyNestedClass m_Nested = new MyNestedClass();

 

         //A readonly property, no setter needed.

         public MyNestedClasss Nested {

                   get { return m_Nested; }

         }

 

}

 

 

<resultmap class=”MyClass”>

         …

         <result property=”Nested.Value” column=”db_nested_col” …/>

</resultmap>

 

 

The mapping causes:

         IBatisNet.Common.Exceptions.ProbeException: There is no Set member
named ‘Nested’ in class ‘MyClass’.

 

Is there a way to tell the ibatis.net to bypass finding the setter of the
‘Nested’ property ?

 

 

Smartkid

 


Re: 答复: iBATIS looking on the wrong place for SqlMap.config SOLVED (for a part)

Posted by Gilles Bayon <ib...@gmail.com>.
Funny, I used iBATIS with VS 2008 and I haven't noticed this bug

-- 
Cheers,
Gilles

答复: iBATIS looking on the wrong place for SqlMap.config SOLVED (for a part)

Posted by smartkid <sk...@gmail.com>.
Visual Studio 2008 has a bug that the tests are not running within an app
domain rooted in the output directory anymore.
So absolute paths should be used until the bug fixed.

smartkid

-----邮件原件-----
发件人: Clough, Samuel (USPC.PRG.Atlanta) [mailto:Samuel_Clough@princetonrg.
com] 
发送时间: 2008年4月22日 0:10
收件人: user-cs@ibatis.apache.org
主题: RE: iBATIS looking on the wrong place for SqlMap.config SOLVED (for a
part)

I apologize in advance if this isn't relevant because I've only been
half paying attention to this thread....

For iBatis files other than the sql map that has to be in web.config, we
include all files (the mapping and provider file) under a namespace in
the project and mark them as embedded resources for compile and
configure the iBatis files appropriately for embedded resources vs.
separate files.  This gets them into source control with our project and
is also a few less files to deploy and for an admin to accidentally
"tweak" when things aren't working.

Not sure if that works for you or not.

-----Original Message-----
From: Juan Pablo Araya [mailto:juanpablo.araya@gmail.com] 
Sent: Monday, April 21, 2008 11:19 AM
To: user-cs@ibatis.apache.org
Subject: Re: iBATIS looking on the wrong place for SqlMap.config SOLVED
(for a part)

Sorry don't know how to face that. As far as I know when you debug
your application the console app search for these files; now when you
are ready with the project, it searches the sqlmap in the root there
is the .exe executable. It's the same when you debug because the
debugger searches for the root in the application that is stored in
that directory.

Sorry :-(

2008/4/21 Pieter Baele <pi...@telenet.be>:
> I know, there was a small syntax fault. Thx for your help!
>  The only problem left is that I want to place the files in some other
> directory the bin/Debug,
>  these files are not commited to my subversion server by visual svn so
I
> need to store them elsewhere.
>
>
>  Pieter Baele
>  pieter.baele@telenet.be
>
>  Adrian Holovaty: "Having Python produce JavaScript is like using a
> motorized wheelchair because you're too lazy to walk."
>
>
>
>
>  On 21 Apr 2008, at 16:43, Juan Pablo Araya wrote:
>
> > You have to add the MySql.Data reference in your web and test
> > projects.
> >
>
> 
--------------------------------------------------------

Princeton Retirement Group, Inc - Important Terms 
This E-mail is not intended for distribution to, or use by, any person or
entity in any location where such distribution or use would be contrary to
law or regulation, or which would subject Princeton Retirement Group, Inc.
or any affiliate to any registration requirement within such location. 
This E-mail may contain privileged or confidential information or may
otherwise be protected by work product immunity or other legal rules. No
confidentiality or privilege is waived or lost by any mistransmission.
Access, copying or re-use of information by non-intended or non-authorized
recipients is prohibited. If you are not an intended recipient of this
E-mail, please notify the sender, delete it and do not read, act upon,
print, disclose, copy, retain or redistribute any portion of this E-mail. 
The transmission and content of this E-mail cannot be guaranteed to be
secure or error-free. Therefore, we cannot represent that the information in
this E-mail is complete, accurate, uncorrupted, timely or free of viruses,
and Princeton Retirement Group, Inc. cannot accept any liability for E-mails
that have been altered in the course of delivery. Princeton Retirement
Group, Inc. reserves the right to monitor, review and retain all electronic
communications, including E-mail, traveling through its networks and systems
(subject to and in accordance with local laws). If any of your details are
incorrect or if you no longer wish to receive mailings such as this by
E-mail please contact the sender by reply E-mail. 

--------------------------------------------------------


RE: iBATIS looking on the wrong place for SqlMap.config SOLVED (for a part)

Posted by "Clough, Samuel (USPC.PRG.Atlanta)" <Sa...@princetonrg.com>.
I apologize in advance if this isn't relevant because I've only been
half paying attention to this thread....

For iBatis files other than the sql map that has to be in web.config, we
include all files (the mapping and provider file) under a namespace in
the project and mark them as embedded resources for compile and
configure the iBatis files appropriately for embedded resources vs.
separate files.  This gets them into source control with our project and
is also a few less files to deploy and for an admin to accidentally
"tweak" when things aren't working.

Not sure if that works for you or not.

-----Original Message-----
From: Juan Pablo Araya [mailto:juanpablo.araya@gmail.com] 
Sent: Monday, April 21, 2008 11:19 AM
To: user-cs@ibatis.apache.org
Subject: Re: iBATIS looking on the wrong place for SqlMap.config SOLVED
(for a part)

Sorry don't know how to face that. As far as I know when you debug
your application the console app search for these files; now when you
are ready with the project, it searches the sqlmap in the root there
is the .exe executable. It's the same when you debug because the
debugger searches for the root in the application that is stored in
that directory.

Sorry :-(

2008/4/21 Pieter Baele <pi...@telenet.be>:
> I know, there was a small syntax fault. Thx for your help!
>  The only problem left is that I want to place the files in some other
> directory the bin/Debug,
>  these files are not commited to my subversion server by visual svn so
I
> need to store them elsewhere.
>
>
>  Pieter Baele
>  pieter.baele@telenet.be
>
>  Adrian Holovaty: "Having Python produce JavaScript is like using a
> motorized wheelchair because you're too lazy to walk."
>
>
>
>
>  On 21 Apr 2008, at 16:43, Juan Pablo Araya wrote:
>
> > You have to add the MySql.Data reference in your web and test
> > projects.
> >
>
> 
--------------------------------------------------------

Princeton Retirement Group, Inc - Important Terms 
This E-mail is not intended for distribution to, or use by, any person or entity in any location where such distribution or use would be contrary to law or regulation, or which would subject Princeton Retirement Group, Inc. or any affiliate to any registration requirement within such location. 
This E-mail may contain privileged or confidential information or may otherwise be protected by work product immunity or other legal rules. No confidentiality or privilege is waived or lost by any mistransmission. Access, copying or re-use of information by non-intended or non-authorized recipients is prohibited. If you are not an intended recipient of this E-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute any portion of this E-mail. 
The transmission and content of this E-mail cannot be guaranteed to be secure or error-free. Therefore, we cannot represent that the information in this E-mail is complete, accurate, uncorrupted, timely or free of viruses, and Princeton Retirement Group, Inc. cannot accept any liability for E-mails that have been altered in the course of delivery. Princeton Retirement Group, Inc. reserves the right to monitor, review and retain all electronic communications, including E-mail, traveling through its networks and systems (subject to and in accordance with local laws). If any of your details are incorrect or if you no longer wish to receive mailings such as this by E-mail please contact the sender by reply E-mail. 

--------------------------------------------------------

Re: iBATIS looking on the wrong place for SqlMap.config SOLVED (for a part)

Posted by Juan Pablo Araya <ju...@gmail.com>.
Sorry don't know how to face that. As far as I know when you debug
your application the console app search for these files; now when you
are ready with the project, it searches the sqlmap in the root there
is the .exe executable. It's the same when you debug because the
debugger searches for the root in the application that is stored in
that directory.

Sorry :-(

2008/4/21 Pieter Baele <pi...@telenet.be>:
> I know, there was a small syntax fault. Thx for your help!
>  The only problem left is that I want to place the files in some other
> directory the bin/Debug,
>  these files are not commited to my subversion server by visual svn so I
> need to store them elsewhere.
>
>
>  Pieter Baele
>  pieter.baele@telenet.be
>
>  Adrian Holovaty: "Having Python produce JavaScript is like using a
> motorized wheelchair because you're too lazy to walk."
>
>
>
>
>  On 21 Apr 2008, at 16:43, Juan Pablo Araya wrote:
>
> > You have to add the MySql.Data reference in your web and test
> > projects.
> >
>
>

Re: iBATIS looking on the wrong place for SqlMap.config SOLVED (for a part)

Posted by Pieter Baele <pi...@telenet.be>.
I know, there was a small syntax fault. Thx for your help!
The only problem left is that I want to place the files in some other  
directory the bin/Debug,
these files are not commited to my subversion server by visual svn so  
I need to store them elsewhere.

Pieter Baele
pieter.baele@telenet.be

Adrian Holovaty: “Having Python produce JavaScript is like using a  
motorized wheelchair because you’re too lazy to walk.”


On 21 Apr 2008, at 16:43, Juan Pablo Araya wrote:
> You have to add the MySql.Data reference in your web and test
> projects.


Re: iBATIS looking on the wrong place for SqlMap.config SOLVED (for a part)

Posted by Juan Pablo Araya <ju...@gmail.com>.
You have to add the MySql.Data reference in your web and test
projects. It's not enough with just tell the config to use the mysql
provider:

right button on the project (web or test) -> add reference...

Then in the "Browse" tab, add the dll.

I'm not using the mysql library, so I suspect it's a dll in some place
of your HD.

Greetings and sorry for my poor english!


2008/4/21 Pieter Baele <pi...@telenet.be>:
> I placed the providers en sqlmap config in bin/debug, then it worked.
>  It isn't that straight-forward.....
>
>  The only problem left now is that it doesn't find the newest mysql.data
> library I added myself.
>  The bytefx provider is really too old .... 2004 (?!) Or is it still a
> better option for a mysql db?
>
>  I have not changed the publickeytoken, can this cause problems? If so,
> where do I find this token?
>  I tried adding the reference provided by the visual studio integration and
> also 'the hard way' by providing and
>  copying the library. None of the two works :-S
>
>  Could not load file or assembly 'MySql.Data, Version=2.0.50727,
> Culture=neutral' or one of its dependencies.
>
>  [code]
>   <provider
>     name="MySql"
>     description="MySQL, MySQL provider v2.0.50727"
>     enabled="true"
>     default="true"
>     assemblyName="MySql.Data, Version=2.0.50727, 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"
>   />
>  [/code]
>
>
>  On 21 Apr 2008, at 01:59, Juan Pablo Araya wrote:
>
> > You have to put your sqlmap.config in the web root directory, or in
> > bin/debug in the test project.
> >
> > Anyway, you can change the path of your sqlmap.config. See section
> > 4.4.1.2. of the datamapper manual.
> >
>
>  Pieter Baele
>  pieter.baele@telenet.be
>  LinuxUser: #310384
>
>  testing? What's that? If it compiles, it is good, if it boots up it is
>  perfect.
>
>                         --- Linus Torvalds
>
>
>
>
>
>
>

Re: iBATIS looking on the wrong place for SqlMap.config SOLVED (for a part)

Posted by Pieter Baele <pi...@telenet.be>.
I placed the providers en sqlmap config in bin/debug, then it worked.
It isn't that straight-forward.....

The only problem left now is that it doesn't find the newest  
mysql.data library I added myself.
The bytefx provider is really too old .... 2004 (?!) Or is it still a  
better option for a mysql db?

I have not changed the publickeytoken, can this cause problems? If so,  
where do I find this token?
I tried adding the reference provided by the visual studio integration  
and also 'the hard way' by providing and
copying the library. None of the two works :-S

Could not load file or assembly 'MySql.Data, Version=2.0.50727,  
Culture=neutral' or one of its dependencies.

[code]
  <provider
     name="MySql"
     description="MySQL, MySQL provider v2.0.50727"
     enabled="true"
     default="true"
     assemblyName="MySql.Data, Version=2.0.50727, 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"
   />
[/code]


On 21 Apr 2008, at 01:59, Juan Pablo Araya wrote:
> You have to put your sqlmap.config in the web root directory, or in
> bin/debug in the test project.
>
> Anyway, you can change the path of your sqlmap.config. See section
> 4.4.1.2. of the datamapper manual.

Pieter Baele
pieter.baele@telenet.be
LinuxUser: #310384

testing? What's that? If it compiles, it is good, if it boots up it is
perfect.

                         --- Linus Torvalds







Re: BATIS (VS2008) looking on the wrong place for SqlMap.config

Posted by Juan Pablo Araya <ju...@gmail.com>.
You have to put your sqlmap.config in the web root directory, or in
bin/debug in the test project.

Anyway, you can change the path of your sqlmap.config. See section
4.4.1.2. of the datamapper manual.

Greetings and sorry for my poor english :-S

2008/4/20 Pieter Baele <pi...@telenet.be>:
> Hi Gilles,
>
>  I did, I put a few hours into iBATIS.NET to get it working already...
>  The mysql provider is enabled. (5.2 edition of the website)
>
>  Do you have iBATIS working in the latest Visual Studio, or do you use 2005?
>
>  Thank you for your time!
>
>  Greetings,
>  ---------------------------
>  Pieter Baele
>
>
>
>
>  On 20 Apr 2008, at 20:55, Gilles Bayon wrote:
>
> > If you read the doc it will be better
> > http://ibatis.apache.org/docs/dotnet/datamapper/ch04s03.html#id398273
> >
> > --
> > Cheers,
> > Gilles
> >
>
>

Re: BATIS (VS2008) looking on the wrong place for SqlMap.config

Posted by Pieter Baele <pi...@telenet.be>.
Hi Gilles,

I did, I put a few hours into iBATIS.NET to get it working already...
The mysql provider is enabled. (5.2 edition of the website)

Do you have iBATIS working in the latest Visual Studio, or do you use  
2005?

Thank you for your time!

Greetings,
---------------------------
Pieter Baele


On 20 Apr 2008, at 20:55, Gilles Bayon wrote:
> If you read the doc it will be better
> http://ibatis.apache.org/docs/dotnet/datamapper/ch04s03.html#id398273
>
> -- 
> Cheers,
> Gilles


Re: BATIS (VS2008) looking on the wrong place for SqlMap.config

Posted by Gilles Bayon <ib...@gmail.com>.
If you read the doc it will be better
http://ibatis.apache.org/docs/dotnet/datamapper/ch04s03.html#id398273

-- 
Cheers,
Gilles

Re: BATIS (VS2008) looking on the wrong place for SqlMap.config

Posted by Pieter Baele <pi...@telenet.be>.
OK, the program could finally find the sqlmap.config,
but now It searches for providers.config in Program Files/blablabla/

It should just search al these config files in the project directory  
itself (solution) ! (?)
Maybe this is a VS2008 / dotNET 3.5 problem?
I feel really stupid because I don't understand this weirdness.
Everything worked very well in java, why not in C#/ASP?




Test method Kronos.Test.MedewerkerTestMap.MedewerkerList threw  
exception:  IBatisNet.Common.Exceptions.ConfigurationException:
- The error occurred while loading Providers. --->   
IBatisNet.Common.Exceptions.ConfigurationException: Unable to load  
file via resource "providers.config" as resource. Cause : Could not  
find file 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE 
\providers.config'. --->  System.IO.FileNotFoundException: Could not  
find file 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE 
\providers.config'..


Pieter Baele
pieter.baele@telenet.be

"Before software should be reusable, it should be usable."
– Ralph Johnson

On 20 Apr 2008, at 18:31, Gilles Bayon wrote:
> http://ibatis.apache.org/docs/dotnet/datamapper/ch04s04.html
>
>
>
> -- 
> Cheers,
> Gilles


Re: BATIS (VS2008) looking on the wrong place for SqlMap.config

Posted by Gilles Bayon <ib...@gmail.com>.
http://ibatis.apache.org/docs/dotnet/datamapper/ch04s04.html



-- 
Cheers,
Gilles

Re: BATIS (VS2008) looking on the wrong place for SqlMap.config

Posted by Pieter Baele <pi...@telenet.be>.
How do you mean?

I  placed the SqlMap.config (+ maps and provider.config) in  
Kronos.Persistence (class library) and Kronos.Test for the unit tests.

Then in the unit test: (MedewerkerMapTest.cs)


[TestMethod()]
public void getListOfMedewerkers()
{
	IList medewerker =  
Mapper.Instance().QueryForList("Medewerker.getAll", null);
	....

}

I thought when you call the mapper instance, it looks for a file  
sqlmap.config in your solution / package.
But it doesn't...



Or do you have to do something like in Java (-iBATIS)? It's not  
mentioned in iBATIS in Action for iBATIS.NET....

String resource = "persistence/sqlmaps/SqlMapConfig.xml";
Reader reader = Resources.getResourceAsReader(resource);
sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(reader);


Pieter Baele
pieter.baele@telenet.be

"Before software should be reusable, it should be usable."
– Ralph Johnson

On 20 Apr 2008, at 17:59, Gilles Bayon wrote:
> How do you used the sqlmap.config file ? You are giving the good  
> path to the file.
>
>
> -- 
> Cheers,
> Gilles


Re: BATIS (VS2008) looking on the wrong place for SqlMap.config

Posted by Gilles Bayon <ib...@gmail.com>.
How do you used the sqlmap.config file ? You are giving the good path to the
file.


-- 
Cheers,
Gilles