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 Rick Reumann <ri...@gmail.com> on 2006/03/25 02:21:13 UTC

Having trouble just getting sqlMap Config validated

I'm trying to use ibatis DataMapper in a winforms 2.0 application. This is
the current error I'm getting:

IBatisNet.Common.Exceptions.ConfigurationException:
- The error occurred while Validate SqlMap config.
- The error occurred in The targetNamespace parameter '' should be the same
value as the targetNamespace 'http://ibatis.apache.org/dataMapper' of the
schema.
The 'sqlMapConfig' element is not declared.
The 'properties' element is not declared.
Could not find schema information for the attribute 'resource'.
The 'settings' element is not declared.
The 'setting' element is not declared.
Could not find schema information for the attribute
'useStatementNamespaces'.
The 'setting' element is not declared.
...</snip>

I'm a bit stumped what that is referring to. My sqlmapconfig is real simple
to start with:

<?xml version="1.0" encoding="utf-8"?>
<sqlMapConfig xmlns="http://ibatis.apache.org/dataMapper" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" >

    <properties resource="properties.config"/>

    <settings>
        <setting useStatementNamespaces="false"/>
        <setting cacheModelsEnabled="true"/>
    </settings>

    <database>
        <provider name="${provider}"/>
        <dataSource name="TestIbatis"
                    connectionString="Server=${server},{port};User
ID=${userid};Password=${password};Database=${database};" />

    </database>

    <sqlMaps>
        <sqlMap resource="ServicesSQL.xml"/>
    </sqlMaps>

</sqlMapConfig>


-----------
I doubt it's even to this stage yet, but in case it matters I'm using mono's
Sybase driver and I added this to my providers.config. ( I have no idea of
what the last boolean parameters should be so I copied another provider's
for tha. The rest should be ok - I hope).

<provider
        name="SybaseMono"
        enabled="true"
        assemblyName="Mono.Data.SybaseClient, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=0738eb9f132ed756"
        connectionClass="Mono.Data.SybaseConnection"
        commandClass="Mono.Data.SybaseCommand"
        parameterClass="Mono.Data.SybaseParameter"
        parameterDbTypeClass="Mono.Data.SybaseType"
        parameterDbTypeProperty="SybaseType"
        dataAdapterClass="Mono.Data.SybaseDataAdapter"
        commandBuilderClass="Mono.Data.SybaseCommandBuilder"
        usePositionalParameters = "false"
        useParameterPrefixInSql = "true"
        useParameterPrefixInParameter = "false"
        parameterPrefix=""
    />


Thanks for any help.

Re: Having trouble just getting sqlMap Config validated

Posted by Ted Husted <te...@gmail.com>.
OK,  making progress ...

My application is using an external properties file. When I added the
SqlMapConfig schema declaration to the properties file, we moved on to
another error.

The external properties file had been using the settings element, but
I changed that to a properties element enclosing property stanzas. The
statements were compiling, but the properties were not be utilized. I
moved the properties element from a separate ifile into the
configuration file, and then everything seemed to resolve.

I have some other problems, but now I seemed to have stepped over into
Spring.NET issues (updating that too).

-Ted.

Re: Having trouble just getting sqlMap Config validated

Posted by Ted Husted <te...@gmail.com>.
On 3/24/06, Rick Reumann <ri...@gmail.com> wrote:
> I'm trying to use ibatis DataMapper in a winforms 2.0 application. This is
> the current error I'm getting:
>
>  IBatisNet.Common.Exceptions.ConfigurationException:
> - The error occurred while Validate SqlMap config.
> - The error occurred in The targetNamespace parameter '' should be the same
> value as the targetNamespace '
> http://ibatis.apache.org/dataMapper' of the schema.
> The 'sqlMapConfig' element is not declared.
>  The 'properties' element is not declared.
> Could not find schema information for the attribute 'resource'.
> The 'settings' element is not declared.
>  The 'setting' element is not declared.
> Could not find schema information for the attribute
> 'useStatementNamespaces'.
> The 'setting' element is not declared.
>  ...</snip>


Me too. I tried updating to the 1.3 release today, and I'm having the
same problem Rick reported here,

* http://www.mail-archive.com/user-cs@ibatis.apache.org/msg00786.html

and that another user reported here:

* http://www.mail-archive.com/user-cs@ibatis.apache.org/msg00700.html

-Ted.

Re: Having trouble just getting sqlMap Config validated

Posted by Gilles Bayon <ib...@gmail.com>.
You should allow association (and validation) of the schemas in VS.NET XML
editor to yours configuration files, add the schema files SqlMap.xsd,
SqlMapConfig.xsd, providers.xsd to your VS.NET installation directory.
The VS.NET directory is

C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas for VS.NET 2005
or
C:\Program Files\Microsoft Visual Studio .NET
2003\Common7\Packages\schemas\xml for VS.NET 2003
The properties file have no schema, it must just follows syntax as
<?xml version="1.0" encoding="utf-8" ?>
<XXX>
<add key="database" value="IBatisNet" />
</XXX>

Samples :
<?xml version="1.0" encoding="utf-8" ?>
<settings>
 <add key="userid" value="IBatisNet" />
 <add key="password" value="test" />
 <add key="database" value="IBatisNet" />
</settings>
or
<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
 <add key="userid" value="IBatisNet" />
 <add key="password" value="test" />
 <add key="database" value="IBatisNet" />
</settings>
The last usage allows me to inccuded and shared it in the app.config with
tag syntax   <appSettings file="../properties.config">

-Gilles

Re: Having trouble just getting sqlMap Config validated

Posted by Ted Husted <te...@gmail.com>.
This is working for me:

<sqlMap
        namespace="event"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="SqlMap.xsd" >

-       xsi:noNamespaceSchemaLocation="SqlMap.xsd" >
+      xmlns="http://ibatis.apache.org/mapping" >

-T.

Re: Having trouble just getting sqlMap Config validated

Posted by Clinton Begin <cl...@gmail.com>.
Heh.. I had the same experience, I couldn't get SQLMap Config validated, the
world was bad....

Then Gilles sent me a small sample app that worked fine.  I never did figure
out what the problem was, but it sounds exactly the same as yours.

Clinton


On 3/25/06, Rick Reumann <ri...@gmail.com> wrote:
>
> Ron's stuff he sent me helped my get past the sqlMapConfig issue. Not sure
> exactly where the problem was but when I added the schema declarations to
> the top of all the xml files, I got much further. Posting another problem
> about the Sybase provider. At least getting closer:)
>
>
> On 3/24/06, Rick Reumann <ri...@gmail.com> wrote:
> >
> >
> > On 3/24/06, Ron Grabowski < rongrabowski@yahoo.com> wrote:
> >
> > > I setup my first .NET 2.0 WinForm app (hooray!) and everything was ok.
> > > I'm using a nightly build.
> >
> >
> >
> > Cool, I'm glad you got yours working! Maybe you could help me figure out
> > what I'm doing wrong? Is there anyway you can strip out some  of your
> > sensitive code (username/password stuff) and e-mail me your profect solution
> > zipped up? I'd love to see it and use it as a model for getting started.
> > Maybe it's something stupid I'm doing wrong but your sqlMapConfig doesn't
> > look that different from mine - but who knows maybe I have some files in the
> > wrong places or it's some other obscure thing messing things up.
> >
> > Thanks if you could send that zipped up.
> >
> >
> >
> >
> >
> >
>
>
>
> --
> Rick
>

Re: Having trouble just getting sqlMap Config validated

Posted by Rick Reumann <ri...@gmail.com>.
Ron's stuff he sent me helped my get past the sqlMapConfig issue. Not sure
exactly where the problem was but when I added the schema declarations to
the top of all the xml files, I got much further. Posting another problem
about the Sybase provider. At least getting closer:)

On 3/24/06, Rick Reumann <ri...@gmail.com> wrote:
>
>
> On 3/24/06, Ron Grabowski <ro...@yahoo.com> wrote:
>
> > I setup my first .NET 2.0 WinForm app (hooray!) and everything was ok.
> > I'm using a nightly build.
>
>
>
> Cool, I'm glad you got yours working! Maybe you could help me figure out
> what I'm doing wrong? Is there anyway you can strip out some  of your
> sensitive code (username/password stuff) and e-mail me your profect solution
> zipped up? I'd love to see it and use it as a model for getting started.
> Maybe it's something stupid I'm doing wrong but your sqlMapConfig doesn't
> look that different from mine - but who knows maybe I have some files in the
> wrong places or it's some other obscure thing messing things up.
>
> Thanks if you could send that zipped up.
>
>
>
>
>
>



--
Rick

Re: Having trouble just getting sqlMap Config validated

Posted by Rick Reumann <ri...@gmail.com>.
On 3/24/06, Ron Grabowski <ro...@yahoo.com> wrote:
>
> I setup my first .NET 2.0 WinForm app (hooray!) and everything was ok.
> I'm using a nightly build.



Cool, I'm glad you got yours working! Maybe you could help me figure out
what I'm doing wrong? Is there anyway you can strip out some  of your
sensitive code (username/password stuff) and e-mail me your profect solution
zipped up? I'd love to see it and use it as a model for getting started.
Maybe it's something stupid I'm doing wrong but your sqlMapConfig doesn't
look that different from mine - but who knows maybe I have some files in the
wrong places or it's some other obscure thing messing things up.

Thanks if you could send that zipped up.

Re: Having trouble just getting sqlMap Config validated

Posted by Ron Grabowski <ro...@yahoo.com>.
I setup my first .NET 2.0 WinForm app (hooray!) and everything was ok.
I'm using a nightly build.

<?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"/>
    <setting cacheModelsEnabled="true"/>
  </settings>
  <database>
    <provider name="OleDb2.0"/>
    <dataSource name="TestIbatis" connectionString="..." />
  </database>
  <sqlMaps>
    <sqlMap resource="ServicesSQL.xml"/>
  </sqlMaps>
</sqlMapConfig>

<?xml version="1.0" encoding="utf-8"?>
<providers 
xmlns="http://ibatis.apache.org/providers" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<clear/>
  <provider name="OleDb2.0" 
      description="OleDb, provider V2.0.0.0 in framework .NET V2" 
      enabled="true"
      assemblyName="System.Data, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" 
      connectionClass="System.Data.OleDb.OleDbConnection" 
      commandClass="System.Data.OleDb.OleDbCommand" 
      parameterClass="System.Data.OleDb.OleDbParameter" 
      parameterDbTypeClass="System.Data.OleDb.OleDbType" 
      parameterDbTypeProperty="OleDbType" 
      dataAdapterClass="System.Data.OleDb.OleDbDataAdapter" 
      commandBuilderClass="System.Data.OleDb.OleDbCommandBuilder" 
      usePositionalParameters="true" 
      useParameterPrefixInSql="false" 
      useParameterPrefixInParameter="false" 
      parameterPrefix=""
    />    
</providers>

<?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">
  <statements>
    <select id="GetMany" resultClass="Hashtable">
      SELECT
      *
      FROM 
      User
    </select>    
  </statements>
</sqlMap>

private void button1_Click(object sender, EventArgs e)
{
 SqlMapper sqlMapper = IBatisNet.DataMapper.Mapper.Instance();
 IMappedStatement getMany = sqlMapper.GetMappedStatement("GetMany");
 MessageBox.Show(getMany.Id);
}

--- Rick Reumann <ri...@gmail.com> wrote:

> I'm trying to use ibatis DataMapper in a winforms 2.0 application.
> This is
> the current error I'm getting:
> 
> IBatisNet.Common.Exceptions.ConfigurationException:
> - The error occurred while Validate SqlMap config.
> - The error occurred in The targetNamespace parameter '' should be
> the same
> value as the targetNamespace 'http://ibatis.apache.org/dataMapper' of
> the
> schema.
> The 'sqlMapConfig' element is not declared.
> The 'properties' element is not declared.
> Could not find schema information for the attribute 'resource'.
> The 'settings' element is not declared.
> The 'setting' element is not declared.
> Could not find schema information for the attribute
> 'useStatementNamespaces'.
> The 'setting' element is not declared.
> ...</snip>
> 
> I'm a bit stumped what that is referring to. My sqlmapconfig is real
> simple
> to start with:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <sqlMapConfig xmlns="http://ibatis.apache.org/dataMapper" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance" >
> 
>     <properties resource="properties.config"/>
> 
>     <settings>
>         <setting useStatementNamespaces="false"/>
>         <setting cacheModelsEnabled="true"/>
>     </settings>
> 
>     <database>
>         <provider name="${provider}"/>
>         <dataSource name="TestIbatis"
>                     connectionString="Server=${server},{port};User
> ID=${userid};Password=${password};Database=${database};" />
> 
>     </database>
> 
>     <sqlMaps>
>         <sqlMap resource="ServicesSQL.xml"/>
>     </sqlMaps>
> 
> </sqlMapConfig>
> 
> 
> -----------
> I doubt it's even to this stage yet, but in case it matters I'm using
> mono's
> Sybase driver and I added this to my providers.config. ( I have no
> idea of
> what the last boolean parameters should be so I copied another
> provider's
> for tha. The rest should be ok - I hope).
> 
> <provider
>         name="SybaseMono"
>         enabled="true"
>         assemblyName="Mono.Data.SybaseClient, Version=2.0.0.0,
> Culture=neutral, PublicKeyToken=0738eb9f132ed756"
>         connectionClass="Mono.Data.SybaseConnection"
>         commandClass="Mono.Data.SybaseCommand"
>         parameterClass="Mono.Data.SybaseParameter"
>         parameterDbTypeClass="Mono.Data.SybaseType"
>         parameterDbTypeProperty="SybaseType"
>         dataAdapterClass="Mono.Data.SybaseDataAdapter"
>         commandBuilderClass="Mono.Data.SybaseCommandBuilder"
>         usePositionalParameters = "false"
>         useParameterPrefixInSql = "true"
>         useParameterPrefixInParameter = "false"
>         parameterPrefix=""
>     />
> 
> 
> Thanks for any help.
>