-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to get SQL output
PostPosted: Tue May 30, 2006 12:08 pm 
Beginner
Beginner

Joined: Tue May 30, 2006 10:55 am
Posts: 21
Hi,

today I started with using NHibernate and I get into trouble during inserting data into the database. I get an error that the insert command is incorrect, but I do not know how to get the SQL output. I have tried to set the show_sql to "true" but I get no output. Here is my config file:


Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration  xmlns="urn:nhibernate-configuration-2.0" >
   <session-factory name="NHibernate.Test">
      <!-- properties -->
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      
      <property name="connection.driver_class">NHibernate.Driver.OleDbDriver</property>
      <property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
          
      <property name="connection.connection_string">
         Provider=Microsoft.Jet.OLEDB.4.0;
         User ID=Admin;
         Data Source=C:\test.mdb;
         Mode=Share Deny None;
         Extended Properties=;
         Locale Identifier=1031;
         Jet OLEDB:Registry Path=;
         Jet OLEDB:Database Password=;
         Jet OLEDB:Engine Type=5;
         Jet OLEDB:Database Locking Mode=1;
         Jet OLEDB:Global Partial Bulk Ops=2;
         Jet OLEDB:Global Bulk Transactions=1;
         Jet OLEDB:New Database Password=geheim;
         Jet OLEDB:Create System Database=False;
         Jet OLEDB:Encrypt Database=True;
         Jet OLEDB:Don't Copy Locale on Compact=False;
         Jet OLEDB:Compact Without Replica Repair=False;
         Jet OLEDB:SFP=False;
      </property>
      <property name="show_sql">true</property>
      <property name="use_outer_join">true</property>
      <property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
      <!-- mapping files -->
                     
      <mapping file="Test.hbm.xml" />
                                                                                                      
   </session-factory>
      
</hibernate-configuration>


I am trying to connect to a .mdb file and calling a select statement works, but insert and update fails. I do not know what is the problem. How can I enable internal logging or what is wrong in my config file?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 30, 2006 2:08 pm 
Expert
Expert

Joined: Fri May 13, 2005 5:56 pm
Posts: 308
Location: Santa Barbara, California, USA
show_sql will only output sql to the console. you will also have to configure log4net. read the doco for more info, but basically you'll have to either add info to your web.config file (for a web app) or an log4net.cfg.xml document for a winForms app, and add a call to log4net.Config.XmlConfigurator.Configure(); in your app...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.