-->
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: Error in Linux using habernate to communicate to sqlserveur
PostPosted: Tue Jan 21, 2014 10:51 am 
Newbie

Joined: Tue Jan 21, 2014 10:42 am
Posts: 1
This is my stack trace:

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: XML parsing: line 1, character 38, unable to switch the encoding
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:156)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1373)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatementBatch(SQLServerPreparedStatement.java:1185)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtBatchExecCmd.doExecute(SQLServerPreparedStatement.java:1101)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4003)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1550)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:160)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:133)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(SQLServerPreparedStatement.java:1065)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)

My file is compile in utf-8 for linux and no encoding in my file, (but i try encoding to utf-8 and utf-16 but same error)

I build my java file in windows
my configuration is

<property name="hibernate.connection.url">jdbc:sqlserver://xxxxxxxxxx;databaseName=xxxxxxxxxxxxxxxxxxx</property>
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServer2008Dialect</property>
<property name="hibernate.connection.isolation">1</property>
<property name="hibernate.connection.username">xxxxxxxxxxxxxxxxxxxx</property>
<property name="hibernate.connection.password">xxxxxxxxxxxxxxxxxxxxxxx</property>

<property name="hibernate.generate_statistics">true</property>
<property name="hibernate.connection.provider_class">com.frimastudio.commons.hibernate.DBCPConnectionProvider</property>
<property name="hibernate.dbcp.initialSize">0</property>
<property name="hibernate.dbcp.maxActive">500</property>
<property name="hibernate.dbcp.maxIdle">500</property>
<property name="hibernate.dbcp.minIdle">0</property>
<property name="hibernate.dbcp.maxWait">-1</property>
<property name="hibernate.dbcp.validationQuery">SELECT 1</property>
<property name="hibernate.dbcp.testOnBorrow">true</property>
<property name="hibernate.dbcp.testOnReturn">false</property>
<property name="hibernate.dbcp.testWhileIdle">false</property>

<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.cache.use_second_level_cache">false</property>
<property name="hibernate.cache.use_query_cache">false</property>
<property name="hibernate.jdbc.batch_size">20</property>
<property name="hibernate.search.autoregister_listeners">false</property>


Top
 Profile  
 
 Post subject: Re: Error in Linux using habernate to communicate to sqlserveur
PostPosted: Wed Jan 22, 2014 4:45 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
from the stacktrace it looks like the problem is not in parsing Hibernate's configuration file, but in executing a query on the database.

you're probably retrieving a wrongly encoded data? Or try adding some encoding options to the JDBC driver.
Also, try jTDS [ http://jtds.sourceforge.net/ ], a very reliable JDBC driver implementation for MS SQL as it looks like a JDBC problem (if it's not a problem in the content of what you've stored in the DB)

_________________
Sanne
http://in.relation.to/


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.