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.  [ 3 posts ] 
Author Message
 Post subject: Why can't I use database transactions when my db is MySQL?
PostPosted: Thu Oct 12, 2006 8:13 pm 
Newbie

Joined: Thu Oct 12, 2006 7:50 pm
Posts: 2
Hi, I am using NHibernate (build 1.0.0.0) with MySQL (version 5.0) to persist .NET v 2.0 objects but whenever I try to use the ITransaction object I get an exception (if I comment it out it works OK but obviously use of db transactions is important for real world apps). I am using VS2005 as my IDE. I have installed and referenced the MySQL ADO.Net driver (version 5.0 the one that supports .NET 2.0). NHibernate can connect to my db and there are no syntax errors in my table structure (else MySQL would not have created it). My mapping file seems OK (any errors and NHibernate would have raised an exception earlier).

Any help would be fantastic.
Cheers,
Katie

Here are the exception details:

09:57:34.396 [4972] ERROR NHibernate.Transaction.AdoTransaction - Begin transaction failed
MySql.Data.MySqlClient.MySqlException: #42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
at MySql.Data.MySqlClient.MySqlStream.OpenPacket()
at MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId)
at MySql.Data.MySqlClient.MySqlDataReader.GetResultSet()
at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
at MySql.Data.MySqlClient.MySqlConnection.BeginTransaction(IsolationLevel iso)
at MySql.Data.MySqlClient.MySqlConnection.BeginDbTransaction(IsolationLevel isolationLevel)
at System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransaction()
at NHibernate.Transaction.AdoTransaction.Begin(IsolationLevel isolationLevel)
A first chance exception of type 'NHibernate.TransactionException' occurred in NHibernate.dll


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 12, 2006 8:20 pm 
Regular
Regular

Joined: Tue Sep 26, 2006 11:37 am
Posts: 115
Location: Sacramento, CA
Katie,

What database engine are you using? Only innodb supports transactions.

Not sure if this is the reason you are having this problem but for sure this is something to check.

Marius


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 12, 2006 8:26 pm 
Newbie

Joined: Thu Oct 12, 2006 7:50 pm
Posts: 2
Hi Marius,
All I know is I am using MySQL Server 5.0. I thought it was an innodb db but will look into it.
Thanks for your help!
Katie


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.