NEO4J's JDBC connection is actually sending an HTTP request (using the httpclient), for Chinese, when inserting data, JDBC uses UTF-8 encoded post submission, but when the Chinese data is returned, it does not indicate that the data is UTF-8 encoding. Therefore, HttpClient will use the platform to parse the data, if the platform encoding is GBK and other coding, the good case, the platform can be encoded after parsing the resultset, and then the correct code to parse the data; in bad cases, the data cannot be parsed when the resultset is dumped. Throw an exception directly.
Solution:
Because NEO4J uses the Restlet processing request, you can modify the Restlet's Clientresource post method, as follows:
/*** Posts a representation. If a success status is no returned, then A * resource exception is thrown. * * @paramEntity * the posted entity. * @returnThe optional result entity. * @throwsresourceexception *@see<a * href= "http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5 ">http * POST method</a>*/ PublicRepresentation post (representation entity)throwsresourceexception {representation R=handle (Method.post, entity); R.setcharacterset (Characterset.utf_8); //through many experiments, neo4j only use this post method, the other post methods do not need to set returnR; }
Then in the change of the source code into a jar package, you can solve the problem of Chinese garbled.
A good bag of Jar:http://pan.baidu.com/s/152uia
neo4j JDBC Chinese garbled