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 Ling Wang <li...@yahoo.com> on 2005/09/12 22:47:01 UTC

npetshop does not work for new user registration

I am getting an error fresh out of box and just could
not figure out what is wrong. I got an error saying

Error executing query 'InsertProfile' for insert.
Cause: Data type mismatch in criteria expression. 

when I was registering a new user.

Everything else seems to work.

I am using the npetshop.mdb database.

Thanks.

Ling

Re: npetshop does not work for new user registration

Posted by Ron Grabowski <ro...@yahoo.com>.
Very strange...

Remove your assembly attribute and try using this Application_OnStart
snippet along with the trace listener code I supplied in another post:

 protected void Application_Start(Object sender, EventArgs e)
 {
  log4net.Config.DOMConfigurator.Configure();
 }

--- Ling Wang <li...@yahoo.com> wrote:

> Ron,
> 
> No, it still does not work.
> I turned on the trace and I saw everyting BUT log4net
> output.
> 
> Here is my web.config:
> 
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> 
> <configSections>
>   <section name="log4net"
> type="log4net.Config.Log4NetConfigurationSectionHandler,
> log4net" />
>  </configSections>
>  
>  	<appSettings>
> 		<add key="StrutsConfigFile"
> value="nstruts-config.xml" />
>   <add key="log4net.Internal.Debug" value="true"/>
>  	</appSettings>      
> 	
>   <system.web>
>     <compilation 
>          defaultLanguage="c#"
>          debug="true"
>     />
> 
>     <customErrors 
>     mode="RemoteOnly" 
>     /> 
> 
>     <authentication mode="Windows" /> 
> 
> 
>     <authorization>
>         <allow users="*" /> <!-- Allow all users -->
>     </authorization>
> 
>     <trace
>         enabled="true"
>         requestLimit="10"
>         pageOutput="true"
>         traceMode="SortByTime"
> 		localOnly="true"
>     />
> 
>     <sessionState 
>             mode="InProc"
>            
> stateConnectionString="tcpip=127.0.0.1:42424"
>             sqlConnectionString="data
> source=127.0.0.1;Trusted_Connection=yes"
>             cookieless="false" 
>             timeout="20" 
>     />
> 
>     <globalization 
>             requestEncoding="utf-8" 
>             responseEncoding="utf-8" 
>    />
>  </system.web>
> 
> <log4net>
>   <appender
>    name="AspNetTraceAppender" 
>    type="log4net.Appender.AspNetTraceAppender" >
>   <layout type="log4net.Layout.SimpleLayout" />
>   </appender>
>   <root>
>    <level value="ALL" />
>    <appender-ref ref="AspNetTraceAppender" />
>   </root>
>  </log4net>
>  
> 
> </configuration>
> 
> Thanks.
> 
> Ling
> 
> 
> --- Ron Grabowski <ro...@yahoo.com> wrote:
> 
> > This log4net configuration will output messages
> > through ASP.Net's Trace
> > object:
> > 
> >  <log4net>
> >   <appender
> >    name="AspNetTraceAppender" 
> >    type="log4net.Appender.AspNetTraceAppender" >
> >   <layout type="log4net.Layout.SimpleLayout" />
> >   </appender>
> >   <root>
> >    <level value="ALL" />
> >    <appender-ref ref="AspNetTraceAppender" />
> >   </root>
> >  </log4net>
> > 
> > In your web.config file, make sure that Trace is
> > enabled and is being
> > output on the page:
> > 
> >  <trace enabled="true" pageOutput="true" />
> > 
> > --- Ling Wang <li...@yahoo.com> wrote:
> > 
> > > Ron,
> > > 
> > > My problem is with how to use log4net to view sql
> > > statement. Besides npetshop, I also tried the
> > > tutorial. None of them works. It would be nice if
> > > someone can show me how to do it. I tried almost
> > > everything according to the documentation.
> > > 
> > > Thanks.
> > > 
> > > Ling
> > 
> 
> 


Re: npetshop does not work for new user registration

Posted by Ling Wang <li...@yahoo.com>.
Ron,

No, it still does not work.
I turned on the trace and I saw everyting BUT log4net
output.

Here is my web.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<configSections>
  <section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler,
log4net" />
 </configSections>
 
 	<appSettings>
		<add key="StrutsConfigFile"
value="nstruts-config.xml" />
  <add key="log4net.Internal.Debug" value="true"/>
 	</appSettings>      
	
  <system.web>
    <compilation 
         defaultLanguage="c#"
         debug="true"
    />

    <customErrors 
    mode="RemoteOnly" 
    /> 

    <authentication mode="Windows" /> 


    <authorization>
        <allow users="*" /> <!-- Allow all users -->
    </authorization>

    <trace
        enabled="true"
        requestLimit="10"
        pageOutput="true"
        traceMode="SortByTime"
		localOnly="true"
    />

    <sessionState 
            mode="InProc"
           
stateConnectionString="tcpip=127.0.0.1:42424"
            sqlConnectionString="data
source=127.0.0.1;Trusted_Connection=yes"
            cookieless="false" 
            timeout="20" 
    />

    <globalization 
            requestEncoding="utf-8" 
            responseEncoding="utf-8" 
   />
 </system.web>

<log4net>
  <appender
   name="AspNetTraceAppender" 
   type="log4net.Appender.AspNetTraceAppender" >
  <layout type="log4net.Layout.SimpleLayout" />
  </appender>
  <root>
   <level value="ALL" />
   <appender-ref ref="AspNetTraceAppender" />
  </root>
 </log4net>
 

</configuration>

Thanks.

Ling


--- Ron Grabowski <ro...@yahoo.com> wrote:

> This log4net configuration will output messages
> through ASP.Net's Trace
> object:
> 
>  <log4net>
>   <appender
>    name="AspNetTraceAppender" 
>    type="log4net.Appender.AspNetTraceAppender" >
>   <layout type="log4net.Layout.SimpleLayout" />
>   </appender>
>   <root>
>    <level value="ALL" />
>    <appender-ref ref="AspNetTraceAppender" />
>   </root>
>  </log4net>
> 
> In your web.config file, make sure that Trace is
> enabled and is being
> output on the page:
> 
>  <trace enabled="true" pageOutput="true" />
> 
> --- Ling Wang <li...@yahoo.com> wrote:
> 
> > Ron,
> > 
> > My problem is with how to use log4net to view sql
> > statement. Besides npetshop, I also tried the
> > tutorial. None of them works. It would be nice if
> > someone can show me how to do it. I tried almost
> > everything according to the documentation.
> > 
> > Thanks.
> > 
> > Ling
> 


Re: npetshop does not work for new user registration

Posted by Ron Grabowski <ro...@yahoo.com>.
This log4net configuration will output messages through ASP.Net's Trace
object:

 <log4net>
  <appender
   name="AspNetTraceAppender" 
   type="log4net.Appender.AspNetTraceAppender" >
  <layout type="log4net.Layout.SimpleLayout" />
  </appender>
  <root>
   <level value="ALL" />
   <appender-ref ref="AspNetTraceAppender" />
  </root>
 </log4net>

In your web.config file, make sure that Trace is enabled and is being
output on the page:

 <trace enabled="true" pageOutput="true" />

--- Ling Wang <li...@yahoo.com> wrote:

> Ron,
> 
> My problem is with how to use log4net to view sql
> statement. Besides npetshop, I also tried the
> tutorial. None of them works. It would be nice if
> someone can show me how to do it. I tried almost
> everything according to the documentation.
> 
> Thanks.
> 
> Ling

Re: npetshop does not work for new user registration

Posted by Ling Wang <li...@yahoo.com>.
Ron,

My problem is with how to use log4net to view sql
statement. Besides npetshop, I also tried the
tutorial. None of them works. It would be nice if
someone can show me how to do it. I tried almost
everything according to the documentation.

Thanks.

Ling

--- Ron Grabowski <ro...@yahoo.com> wrote:

> Are you using the "NPetShop Example Application"
> from this page:
> 
>  http://ibatis.apache.org/downloads.html
> 
> That was compiled 10/4/2004 and aside from being
> close to a year old,
> its at least 3 versions behind of the current
> version in SVN.
> 
> Unfortunetly the version of NPetShop in SVN isn't as
> up to date as it
> should be. I think a quick recompile and a
> double-check of the mapping
> files could fix that. I'll look into doing that (at
> least for MySQL and
> Access)...
> 
> --- Ling Wang <li...@yahoo.com> wrote:
> 
> > I am getting an error fresh out of box and just
> could
> > not figure out what is wrong. I got an error
> saying
> > 
> > Error executing query 'InsertProfile' for insert.
> > Cause: Data type mismatch in criteria expression. 
> > 
> > when I was registering a new user.
> > 
> > Everything else seems to work.
> > 
> > I am using the npetshop.mdb database.
> > 
> > Thanks.
> > 
> > Ling
> > 
> 
> 


Re: npetshop does not work for new user registration

Posted by Ron Grabowski <ro...@yahoo.com>.
IBatisNet has had this feature for quite some time (sorry for the line
wrapping):

DEBUG 2005-09-12 06:03:31 PM (Commands.DefaultPreparedCommand:138) -
Statement Id: [User.Authenticate] PreparedStatement : [SELECT UserId,
Login, Password, Name, EmailAddress, LastLogin, DateAdded,
DateLastUpdated FROM [User] WHERE Login = ? AND Password = ?]

DEBUG 2005-09-12 06:03:31 PM (Commands.DefaultPreparedCommand:138) -
Statement Id: [User.Authenticate] Parameters: [param0=[Login,ron],
param1=[Password,45798F269709550D6F6E1D2CF4B7D485]]

DEBUG 2005-09-12 06:03:31 PM (Commands.DefaultPreparedCommand:138) -
Statement Id: [User.Authenticate] Types: [param0=[String,
System.String], param1=[String, System.String]]

In fact there's even code in SVN to display results sent back from the
database before IBatisNet processes the result set. Its still buggy
though (uses to many system resources ???).

It sounds like your log4net is not being initialized correctly. To
debug that problem, we need to see log4net's internal debug messages
(probably being written to log4net.txt).

FYI, 45798F269709550D6F6E1D2CF4B7D485 is just "ron":

 http://gdataonline.com/

--- Ling Wang <li...@yahoo.com> wrote:

> Ron,
> 
> Yes, it is the version I am trying. It runs ok untill
> registering new users. I am ok with it even with the
> bugs. My problem is how am I supposed to debug it if I
> do not see my sql statement? 
> 
> Be nice if you can turn on log4net together with other
> means to show sql statement. I am sure there are many
> users how are interested in seeing this.
> 
> Thanks.
> 
> Ling
> 
> --- Ron Grabowski <ro...@yahoo.com> wrote:
> 
> > Are you using the "NPetShop Example Application"
> > from this page:
> > 
> >  http://ibatis.apache.org/downloads.html
> > 
> > That was compiled 10/4/2004 and aside from being
> > close to a year old,
> > its at least 3 versions behind of the current
> > version in SVN.
> > 
> > Unfortunetly the version of NPetShop in SVN isn't as
> > up to date as it
> > should be. I think a quick recompile and a
> > double-check of the mapping
> > files could fix that. I'll look into doing that (at
> > least for MySQL and
> > Access)...
> > 
> > --- Ling Wang <li...@yahoo.com> wrote:
> > 
> > > I am getting an error fresh out of box and just
> > could
> > > not figure out what is wrong. I got an error
> > saying
> > > 
> > > Error executing query 'InsertProfile' for insert.
> > > Cause: Data type mismatch in criteria expression. 
> > > 
> > > when I was registering a new user.
> > > 
> > > Everything else seems to work.
> > > 
> > > I am using the npetshop.mdb database.
> > > 
> > > Thanks.
> > > 
> > > Ling
> > > 
> > 
> > 
> 
> 


Re: npetshop does not work for new user registration

Posted by Ling Wang <li...@yahoo.com>.
Ron,

Yes, it is the version I am trying. It runs ok untill
registering new users. I am ok with it even with the
bugs. My problem is how am I supposed to debug it if I
do not see my sql statement? 

Be nice if you can turn on log4net together with other
means to show sql statement. I am sure there are many
users how are interested in seeing this.

Thanks.

Ling

--- Ron Grabowski <ro...@yahoo.com> wrote:

> Are you using the "NPetShop Example Application"
> from this page:
> 
>  http://ibatis.apache.org/downloads.html
> 
> That was compiled 10/4/2004 and aside from being
> close to a year old,
> its at least 3 versions behind of the current
> version in SVN.
> 
> Unfortunetly the version of NPetShop in SVN isn't as
> up to date as it
> should be. I think a quick recompile and a
> double-check of the mapping
> files could fix that. I'll look into doing that (at
> least for MySQL and
> Access)...
> 
> --- Ling Wang <li...@yahoo.com> wrote:
> 
> > I am getting an error fresh out of box and just
> could
> > not figure out what is wrong. I got an error
> saying
> > 
> > Error executing query 'InsertProfile' for insert.
> > Cause: Data type mismatch in criteria expression. 
> > 
> > when I was registering a new user.
> > 
> > Everything else seems to work.
> > 
> > I am using the npetshop.mdb database.
> > 
> > Thanks.
> > 
> > Ling
> > 
> 
> 


Re: npetshop does not work for new user registration

Posted by Ron Grabowski <ro...@yahoo.com>.
Are you using the "NPetShop Example Application" from this page:

 http://ibatis.apache.org/downloads.html

That was compiled 10/4/2004 and aside from being close to a year old,
its at least 3 versions behind of the current version in SVN.

Unfortunetly the version of NPetShop in SVN isn't as up to date as it
should be. I think a quick recompile and a double-check of the mapping
files could fix that. I'll look into doing that (at least for MySQL and
Access)...

--- Ling Wang <li...@yahoo.com> wrote:

> I am getting an error fresh out of box and just could
> not figure out what is wrong. I got an error saying
> 
> Error executing query 'InsertProfile' for insert.
> Cause: Data type mismatch in criteria expression. 
> 
> when I was registering a new user.
> 
> Everything else seems to work.
> 
> I am using the npetshop.mdb database.
> 
> Thanks.
> 
> Ling
>