You can use SQL Java Database Connectivity (JDBC) to access the search engine service named LindormSearch. This topic describes how to use the open source Solr JDBC to access the LindormSearch service.

Add the Maven dependency

Add the following dependency to the pom.xml file of your Java application:


Obtain the endpoint to access your cluster

After the LindormSearch service is activated in the Lindorm console, you can choose Instance List > Database Connection > Search Engine. On the Search Engine tab, obtain the endpoint of your cluster.

Note You can use SQL JDBC to access LindormSearch only over private endpoints.

Create an index

You can create a collection on the Cluster Management page. In addition, you can refer to the steps in the document to write test data to the collection.

Example code


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class SqlDemo {
  private static String zkHost = "Private endpoint";
  private static String collection = "demoindex";

  static {
    try {
    } catch (Throwable t) {

  public static void main(String[] args) throws Exception {;

  public static void run() throws Exception {
    Connection con = null;
    ResultSet rs = null;
    Statement stmt = null;
    try {
      con = DriverManager.getConnection("jdbc:solr://" + zkHost + "?collection=" + collection);
      stmt = con.createStatement();
      rs = stmt.executeQuery("SELECT id,name_s,age_i FROM " + collection + " ORDER BY age_i desc");

      while( {
        System.out.println(rs.getString("id") + ",name=" + rs.getString("name_s") + ",age=" + rs.getInt("age_i"));
    } catch (Exception e ) {
    } finally {
      if (null != rs) {
      if (null != stmt) {

You can join the expert service group or submit a ticket to obtain information about other advanced SQL syntax. For more information, see Expert support.