Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Ok, this works for fulltext search. Heres what I ran. First I inserted into the database (via mysql console):</p> <pre><code>insert into user_info values('themanager', 'password', 'email@test.com'); </code></pre> <p>Once I had that I ran:</p> <pre><code>import static org.junit.Assert.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import org.junit.Test; public class TestMysql { private String dbUrl = "jdbc:mysql://localhost:3306/test"; private String user = "root"; private String password = "password"; private String dbClass = "com.mysql.jdbc.Driver"; private String query = "SELECT username, email FROM user_info WHERE MATCH (username, email) AGAINST ('themanager' IN BOOLEAN MODE)"; @Test public void test() { try { Class.forName(dbClass); Connection con = DriverManager.getConnection (dbUrl, user, password); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { String username = rs.getString(1); System.out.println("FOUND: '" + username + "'"); } //end while con.close(); } //end try catch(ClassNotFoundException e) { e.printStackTrace(); } catch(SQLException e) { e.printStackTrace(); } } } </code></pre> <p>That printed: FOUND: 'themanager'</p> <p>Try that. Let me know if it fails. If it does, it could well be a connection issue</p> <p>see: <a href="http://www.petefreitag.com/item/477.cfm" rel="nofollow">http://www.petefreitag.com/item/477.cfm</a> for more info about FULLTEXT querying</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload