{"id":285,"date":"2010-04-30T23:19:21","date_gmt":"2010-04-30T22:19:21","guid":{"rendered":"http:\/\/kudzia.eu\/b\/?p=285"},"modified":"2013-10-05T11:56:44","modified_gmt":"2013-10-05T10:56:44","slug":"talking-to-sphinxql-from-java","status":"publish","type":"post","link":"https:\/\/kudzia.eu\/b\/2010\/04\/talking-to-sphinxql-from-java\/","title":{"rendered":"talking to SphinxQL from java"},"content":{"rendered":"<p>since a while <a href=\"http:\/\/sphinxsearch.com\">Sphinx search<\/a> can be queried not only by their own non-standard interface but also using regular mysql client. they call this feature SphinxQL.<br \/>\n<!--more--><br \/>\nso my <a href=\"http:\/\/www.macrobond.com\">work<\/a>&#8216;s backend no longer has to rely on my own failover code for sphinx &#8211; i can leave the dirty details to <a href=\"http:\/\/caucho.com\">resin<\/a>. appserv is already providing resiliency for communication with mysql servers.<\/p>\n<p>but.. it turned out it was not enough to configure database driver pointing to a sphinx server. when i did it i was getting exceptions:<br \/>\n<code><br \/>\n[08:56:11.466] Caused by: java.lang.IllegalArgumentException: Null charset name<br \/>\n[08:56:11.466]  at java.nio.charset.Charset.lookup(Charset.java:429)<br \/>\n[08:56:11.466]  at java.nio.charset.Charset.forName(Charset.java:502)<br \/>\n[08:56:11.466]  at com.mysql.jdbc.ConnectionImpl.configureClientCharacterSet(ConnectionImpl.java:1936)<br \/>\n<\/code><\/p>\n<p>so i added at the end of the connection string:<br \/>\n<code><br \/>\ncharacterEncoding=utf8<br \/>\n<\/code><\/p>\n<p>but then i got this:<br \/>\n<code><br \/>\n[09:15:58.498] appserv.ParalellEntitySearcher  - problems occured com.mysql.jdbc.PacketTooBigException: Packet for query is too large (26 > -1). You can change this value on the server by setting the max_allowed_packet' variable.<br \/>\n[09:15:58.498]  at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:612)<br \/>\n[09:15:58.498]  at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:415)<br \/>\n[09:15:58.498]  at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:2576)<br \/>\n[09:15:58.498]  at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1757)<br \/>\n<\/code><\/p>\n<p>so i added this at the end of the connection string:<br \/>\n<code><br \/>\nmaxAllowedPacket=512000<br \/>\n<\/code><br \/>\nquite a generous number, probably 1\/20th would do a trick too.<\/p>\n<p>maybe someone will find this useful..<\/p>\n","protected":false},"excerpt":{"rendered":"<p>since a while Sphinx search can be queried not only by their own non-standard interface but also using regular mysql client. they call this feature SphinxQL.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-285","post","type-post","status-publish","format-standard","hentry","category-tech"],"_links":{"self":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/285","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/comments?post=285"}],"version-history":[{"count":8,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/285\/revisions"}],"predecessor-version":[{"id":1931,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/285\/revisions\/1931"}],"wp:attachment":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/media?parent=285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/categories?post=285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/tags?post=285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}