We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Java Hibernate Error: Unsupported VM encoding MS936.

killdurst
killdurst asked
on
Medium Priority
878 Views
Last Modified: 2013-12-15
Hi, I have a class called TestDAO (see code below), and the following is the output:

allGames.length: 20
allMatches.length: 59

When I modified TestDAO's main method to the following:

            JjCompetitionDAO jjCompetitionDAO = new JjCompetitionDAO();
            Object[] allCompetitions = jjCompetitionDAO.findAll().toArray();
            System.out.println("allCompetitions.length: " + allCompetitions.length);

I get the following error:

Exception in thread "main" org.hibernate.exception.GenericJDBCException: could not execute query
      at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      at org.hibernate.loader.Loader.doList(Loader.java:2148)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
      at org.hibernate.loader.Loader.list(Loader.java:2024)
      at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
      at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
      at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106)
      at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
      at com.JjCompetitionDAO.findAll(JjCompetitionDAO.java:96)
      at com.TestDAO.main(TestDAO.java:8)
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unsupported VM encoding MS936.
      at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
      at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
      at com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.processReplyToken(Unknown Source)
      at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
      at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
      at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
      at com.microsoft.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
      at com.microsoft.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)
      at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
      at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source)
      at com.microsoft.jdbc.base.BasePreparedStatement.executeQuery(Unknown Source)
      at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
      at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
      at org.hibernate.loader.Loader.doQuery(Loader.java:662)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
      at org.hibernate.loader.Loader.doList(Loader.java:2145)
      ... 9 more

-----

Does anybody know why this error occurs and how to fix it? I've googled it but found a lot of sites in Chinese.
TestDAO.java:
 
package com;
 
public class TestDAO {
	
	public static void main(String[] args)
	{	
		JjCompetitionGameDAO jjCompetitionGameDAO = new JjCompetitionGameDAO();
		Object[] allGames = jjCompetitionGameDAO.findAll().toArray();
		System.out.println("allGames.length: " + allGames.length);
	
		JjCompetitionGameMatchDAO jjCompetitionGameMatchDAO = new JjCompetitionGameMatchDAO();
		Object[] allMatches = jjCompetitionGameMatchDAO.findAll().toArray();
		System.out.println("allMatches.length: " + allMatches.length);
	}
 
}

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016

Commented:
You need to ensure you have full multilingual support installed. See

http://www.blogjava.net/kalman03/archive/2008/12/18/247194.html
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
First make sure you aren't using an english only version of the java vm.
Then check the encoding used in the connection string is supported by the vm you have installed.

Author

Commented:
Before I go and re-download and re-install the jdk again, how do I check what is the language of my current JDK? Thanks.
CERTIFIED EXPERT
Top Expert 2016
Commented:
There's no such thing as the 'language' of the JDK. It's a question of whether you installed full multilingual support or not. If you still have the installer for the present one, you might be able to use that

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
you don't need to redownload (just reinstall), the installer includes everything. Just make sure when you install that you that you include the support you require.

Author

Commented:
Hi guys, I was just checking the build path of my project and I found out that it was pointing to the workspace default, which was jre1.5.0_06. I changed it to point to my jdk1.6.0_03 and it's working fine now. Not getting the error message anymore! :)
CERTIFIED EXPERT
Top Expert 2016

Commented:
:-)
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.