-->
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: Problems switching from MSSQL to MySQL
PostPosted: Tue Aug 16, 2005 7:25 pm 
Regular
Regular

Joined: Fri May 13, 2005 4:08 pm
Posts: 64
I rewrote the .config file to connect to MySQL instead of SQL Server, to see how well NHibernate could just switch databases, and I ran into a problem. I'll include the relevant log4net log output at the bottom of this post. Here is what I believe is the relevant context:

The database is successfully built by NHibernate.
Adding some entities seems to work fine, but others seem to cause the error.
I have unicode strings with spanish, portuguese, and japanese characters that I'm saving to the database.
I installed MySQL 4.1.13a for Windows to default to the utf-8 character set.
I am using the MySQL Connector Net 1.0.4.

Below is the log output. Any help would be greatly appreciated!

Code:
2005-08-16 17:14:01,261 [TestCasemanager::ExecutionThread] DEBUG NHibernate.Persister.EntityPersister [(null)] <(null)> - Inserting entity: Byu.Fhss.Sfl.Purchasing.Product (native id)
2005-08-16 17:14:01,261 [TestCasemanager::ExecutionThread] DEBUG NHibernate.Impl.BatcherImpl [(null)] <(null)> - Opened new IDbCommand, open IDbCommands :1
2005-08-16 17:14:01,261 [TestCasemanager::ExecutionThread] DEBUG NHibernate.Impl.BatcherImpl [(null)] <(null)> - Building an IDbCommand object for the SqlString: INSERT INTO product (Name, Price) VALUES (:Name, :Price)
2005-08-16 17:14:01,261 [TestCasemanager::ExecutionThread] DEBUG NHibernate.Impl.BatcherImpl [(null)] <(null)> - Opened new IDbCommand, open IDbCommands :2
2005-08-16 17:14:01,261 [TestCasemanager::ExecutionThread] DEBUG NHibernate.Impl.BatcherImpl [(null)] <(null)> - Building an IDbCommand object for the SqlString: SELECT LAST_INSERT_ID()
2005-08-16 17:14:01,261 [TestCasemanager::ExecutionThread] DEBUG NHibernate.Persister.EntityPersister [(null)] <(null)> - Dehydrating entity: Byu.Fhss.Sfl.Purchasing.Product#
2005-08-16 17:14:01,261 [TestCasemanager::ExecutionThread] DEBUG NHibernate.Type.NullableType [(null)] <(null)> - binding 'READY' to parameter: 0
2005-08-16 17:14:01,261 [TestCasemanager::ExecutionThread] DEBUG NHibernate.Type.NullableType [(null)] <(null)> - binding '10' to parameter: 1
2005-08-16 17:14:01,261 [TestCasemanager::ExecutionThread] INFO  NHibernate.Impl.BatcherImpl [(null)] <(null)> - Preparing INSERT INTO product (Name, Price) VALUES (?p0, ?p1)
2005-08-16 17:14:01,261 [TestCasemanager::ExecutionThread] ERROR NHibernate.Persister.EntityPersister [(null)] <(null)> - #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 '10)' at line 1
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 '10)' at line 1
   at MySql.Data.MySqlClient.PacketReader.CheckForError()
   at MySql.Data.MySqlClient.PacketReader.ReadHeader()
   at MySql.Data.MySqlClient.PacketReader.OpenPacket()
   at MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId)
   at MySql.Data.MySqlClient.CommandResult.ReadNextResult(Boolean isFirst)
   at MySql.Data.MySqlClient.NativeDriver.SendQuery(Byte[] bytes, Int32 length, Boolean consume)
   at MySql.Data.MySqlClient.MySqlCommand.GetNextResultSet(MySqlDataReader reader)
   at MySql.Data.MySqlClient.MySqlCommand.Consume()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
   at NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd)
   at NHibernate.Persister.EntityPersister.Insert(Object[] fields, Boolean[] notNull, SqlString sql, Object obj, ISessionImplementor session)
2005-08-16 17:14:01,292 [TestCasemanager::ExecutionThread] DEBUG NHibernate.Impl.BatcherImpl [(null)] <(null)> - Closed IDbCommand, open IDbCommands :1
2005-08-16 17:14:01,292 [TestCasemanager::ExecutionThread] DEBUG NHibernate.Impl.BatcherImpl [(null)] <(null)> - Closed IDbCommand, open IDbCommands :0
2005-08-16 17:14:01,292 [TestCasemanager::ExecutionThread] ERROR NHibernate.ADOException [(null)] <(null)> - Could not save object
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 '10)' at line 1
   at MySql.Data.MySqlClient.PacketReader.CheckForError()
   at MySql.Data.MySqlClient.PacketReader.ReadHeader()
   at MySql.Data.MySqlClient.PacketReader.OpenPacket()
   at MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId)
   at MySql.Data.MySqlClient.CommandResult.ReadNextResult(Boolean isFirst)
   at MySql.Data.MySqlClient.NativeDriver.SendQuery(Byte[] bytes, Int32 length, Boolean consume)
   at MySql.Data.MySqlClient.MySqlCommand.GetNextResultSet(MySqlDataReader reader)
   at MySql.Data.MySqlClient.MySqlCommand.Consume()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
   at NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd)
   at NHibernate.Persister.EntityPersister.Insert(Object[] fields, Boolean[] notNull, SqlString sql, Object obj, ISessionImplementor session)
   at NHibernate.Persister.EntityPersister.Insert(Object[] fields, Object obj, ISessionImplementor session)
   at NHibernate.Impl.ScheduledIdentityInsertion.Execute()
   at NHibernate.Impl.SessionImpl.DoSave(Object obj, Key key, IClassPersister persister, Boolean replicate, Boolean useIdentityColumn, CascadingAction cascadeAction, Object anything)
   at NHibernate.Impl.SessionImpl.DoSave(Object obj, Object id, IClassPersister persister, Boolean useIdentityColumn, CascadingAction cascadeAction, Object anything)
   at NHibernate.Impl.SessionImpl.SaveWithGeneratedIdentifier(Object obj, CascadingAction action, Object anything)
[/list]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 17, 2005 11:00 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
There is a bug in the current mysql connector which prevents decimal parameters from working. Wait for the next version of the connector, or try building it from CVS.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 17, 2005 6:54 pm 
Regular
Regular

Joined: Fri May 13, 2005 4:08 pm
Posts: 64
sergey wrote:
There is a bug in the current mysql connector which prevents decimal parameters from working. Wait for the next version of the connector, or try building it from CVS.

I downloaded the very latest of MySql Connector/Net from BitKeeper and built it. I tore out the Connector/Net 1.0.4 release that was in the GAC and put mine in there, and the exact same error remains.

Looking at the change logs for Connector/Net, it doesn't look like much has happened to it in the last 6 months, and decimal bug fixes are not listed.

Maybe I'm misunderstanding what you were suggesting. But do you know if this bug has already been fixed?


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.