问题描述
我正在使用SphinxQL MySQL客户端,该客户端将索引存储为表",但没有真正的数据库"概念...一个指定了sphinx mysql实例在理论上侦听的端口(在我的情况下为9306)应该能够正常通信.
I am using the SphinxQL MySQL client which stores indexes as "tables" but has no real notion of a "database"...One specifies the port (9306 in my case) at which the sphinx mysql instance listens and in theory should be able to communicate as normal.
我有以下测试代码:
import java.sql.*;
public class Dbtest {
public static void main (String[] args) {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:9306",
"user","password");
con.setReadOnly(true);
Statement stmt = con.createStatement();
ResultSet res = stmt.executeQuery("SELECT * from index_turned_table");
while (res.next()) {
String stuff1 = res.getString(1);
String stuff2 = res.getString(2);
System.out.println("Adding " + stuff1);
System.out.println("Adding " + stuff2);
}
res.close();
stmt.close();
con.close();
}
catch(Exception e)
{
System.out.println (e);
}
}
在执行时,代码只是挂起,什么也不做,也不会打印出异常.我可以做些什么有用的事情来解决这个问题,或者如果有任何直接的经验,会发生什么?
Upon execution, the code just hangs and does nothing and doesn't print out an exception. What are useful things I can do to figure this out or if any one has direct experience what might be going on?
推荐答案
适用于1.10-beta http://www.olegsmith.com/2010/12/scalalift-sphinxql.html 不适用于2.0.1-beta.使用mysql-connector-java 5.1.15.
This work with 1.10-beta http://www.olegsmith.com/2010/12/scalalift-sphinxql.htmland not work with 2.0.1-beta. Use mysql-connector-java 5.1.15.
这篇关于不指定数据库的JDBC MYSQL连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!