OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Tugraph

V3.3.3Enterprise Edition

  • Guide
    • What is a graph
    • What is a graph database
    • TuGraph Quick Start
  • Operating
    • Introduction
    • Installation
    • Data Importing
    • Service configuration
    • Service operations
    • Tools
      • tugraph_cypher Instructions
      • TuGraph Browser
      • TuGraph DataX Instructions
      • TuGraph Explore Instructions
    • High Availability mode
    • Database Management
    • User rights Management
  • Developer Document
    • TuGraph RESTful API
    • TuGraph-Cypher
    • TuGraph Stored Procedure Guide
    • Graph Analytics Engine
      • Bootstrap program
      • OlapBase API
      • OlapOnDB API
      • OlapOnDisk API
      • TuGraph Built-in Algorithm Description
  • Client
    • TuGraph Java SDK
    • TuGraph Python SDK
    • TuGraph C++ SDK
  • Supplement
    • Update the content description
  • Community
    • TuGraph Contribution Guide
    • TuGraph community roles
    • TuGraph Open source planning
    • Ant_Group_Open_Source_Individual_CLA_English_Chinese_2021
    • Ant_Group_Open_Source_Corporate_CLA_English_Chinese_2021

Download PDF

What is a graph What is a graph database TuGraph Quick Start Introduction Installation Data Importing Service configuration Service operations tugraph_cypher Instructions TuGraph Browser TuGraph DataX Instructions TuGraph Explore Instructions High Availability mode Database Management User rights Management TuGraph RESTful API TuGraph-Cypher TuGraph Stored Procedure Guide Bootstrap program OlapBase API OlapOnDB API OlapOnDisk API TuGraph Built-in Algorithm Description TuGraph Java SDK TuGraph Python SDK TuGraph C++ SDK Update the content description TuGraph Contribution Guide TuGraph community roles TuGraph Open source planningAnt_Group_Open_Source_Individual_CLA_English_Chinese_2021Ant_Group_Open_Source_Corporate_CLA_English_Chinese_2021
OceanBase logo

The Unified Distributed Database for the AI Era.

Follow Us
Products
OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
Resources
DocsBlogLive DemosTraining & Certification
Company
About OceanBaseTrust CenterLegalPartnerContact Us
Follow Us

© OceanBase 2026. All rights reserved

Cloud Service AgreementPrivacy PolicySecurity
Contact Us
Document Feedback
  1. Documentation Center
  2. OceanBase Tugraph
  3. V3.3.3
iconOceanBase Tugraph
V 3.3.3Enterprise Edition

TuGraph Java SDK

Last Updated:2023-06-25 03:23:24  Updated
share
What is on this page
Compile java client code
Demo
Instantiate the client object
Call cypher
Call stored procedure
Load stored procedure
Import from a byte stream schema
Import point edge data from byte stream
Import from a file schema
Import edge data from a file

folded

share

Compile java client code

cd src/client/java/TuGraphRpcClient
sh local_build.sh

Demo

Instantiate the client object

Introduce dependencies and instantiate

import com.alipay.tugraph.TuGraphRpcClient;
TuGraphRpcClient client = new TuGraphRpcClient(url, user, password);
# If tugraph is launched from docker
url      : list://ip:9090
user     : admin
password : 73@TuGraph
public TuGraphRpcClient(String url, String user, String pass)
@param url: tugraph host looks like list://ip:port
@param user: login user name
@param password: login password

Call cypher

    String res = client.callCypher("CALL db.edgeLabels()", "default", 10);
    log.info("db.edgeLabels() : " + res);
    @param cypher: inquire statement.
    @param graph: the graph to query.
    @param timeout: Maximum execution time, overruns will be interrupted
    @return: the result of cypher query execution
    public String callCypher(String cypher, String graph, double timeout)

Call stored procedure

    String result = client.callPlugin("CPP", "khop", kHopParamGen(), 1000, false, "default", 1000);
    log.info("testCallPlugin : " + result);
    @param pluginType: the plugin type, currently supported CPP and PY
    @param pluginName: plugin name
    @param param: the execution parameters
    @param pluginTimeOut: Maximum execution time, overruns will be interrupted
    @param graph: the graph to query.
    @param timeout: Maximum execution time, overruns will be interrupted
    @return: the result of plugin execution
    public String callPlugin(String pluginType, String pluginName, String param, double pluginTimeOut,
            boolean inProcess, String graph, double timeout)

Load stored procedure

    String result = client.loadPlugin("./test/plugin/khop.so", "CPP", "khop", "SO", "test loadplugin", true, "default", 1000);
    log.info("loadPlugin : " + result);
    @param sourceFile: the source_file contain plugin code
    @param pluginType: the plugin type, currently supported CPP and PY
    @param pluginName: plugin name
    @param codeType: code type, currently supported PY, SO, CPP, ZIP
    @param pluginDescription: plugin description
    @param readOnly: plugin is read only or not
    @param graph: the graph to query.
    @param timeout: Maximum execution time, overruns will be interrupted
    @return: the result of plugin execution
    public boolean loadPlugin(String sourceFile, String pluginType, String pluginName, String codeType,
            String pluginDescription, boolean readOnly, String graph, double timeout) throws IOException

Import from a byte stream schema

    boolean ret = client.importSchemaFromContent(schema, "default", 1000);
    log.info("importSchemaFromContent : " + ret);
    @param schema: the schema to be imported
    @param graph: the graph to query.
    @param timeout: Maximum execution time, overruns will be interrupted
    @return: the result of import schema
    public boolean importSchemaFromContent(String schema, String graph, double timeout) throws UnsupportedEncodingException

Import point edge data from byte stream

    boolean ret = client.importDataFromContent(personDesc, person, ",", true, 16, "default", 1000);
    log.info("importDataFromContent : " + ret);
    @param desc: data format description
    @param data: the data to be imported
    @param delimiter: data separator
    @param continueOnError: whether to continue when importing data fails
    @param threadNums: maximum number of threads
    @param graph: the graph to query.
    @param timeout: Maximum execution time, overruns will be interrupted
    @return: the result of import data
    public boolean importDataFromContent(String desc, String data, String delimiter, boolean continueOnError,
            int threadNums, String graph, double timeout) throws UnsupportedEncodingException

Import from a file schema

    boolean ret = client.importSchemaFromFile("./test/data/yago.conf", "default", 1000);
    log.info("importSchemaFromFile : " + ret);
    @param schemaFile: the schema_file contain schema
    @param graph: the graph to query.
    @param timeout: Maximum execution time, overruns will be interrupted
    @return: the result of import schema
    public boolean importSchemaFromFile(String schemaFile, String graph, double timeout)
            throws UnsupportedEncodingException, IOException

Import edge data from a file

    boolean ret = client.importDataFromFile("./test/data/yago.conf", ",", true, 16, 0, "default", 1000000000);
    log.info("importDataFromFile : " + ret);
    @param confFile: data file contain format description and data
    @param delimiter: data separator
    @param continueOnError: whether to continue when importing data fails
    @param threadNums: maximum number of threads
    @param skipPackages: skip packages number
    @param graph: the graph to query.
    @param timeout: Maximum execution time, overruns will be interrupted
    @return: the result of import data
    public boolean importDataFromFile(String confFile, String delimiter, boolean continueOnError, int threadNums,
            int skipPackages, String graph, double timeout) throws IOException, UnsupportedEncodingException

Previous topic

TuGraph Built-in Algorithm Description
Last

Next topic

TuGraph Python SDK
Next
What is on this page
Compile java client code
Demo
Instantiate the client object
Call cypher
Call stored procedure
Load stored procedure
Import from a byte stream schema
Import point edge data from byte stream
Import from a file schema
Import edge data from a file