Code Monkey home page Code Monkey logo

obconnector-j's Introduction

OceanBase Logo

English doc Chinese doc last commit stars building status license

Join Slack Stack Overflow

English | 中文版

OceanBase Database is a distributed relational database. It is developed entirely by Ant Group. The OceanBase Database is built on a common server cluster. Based on the Paxos protocol and its distributed structure, the OceanBase Database provides high availability and linear scalability. The OceanBase Database is not dependent on specific hardware architectures.

Key features

  • Transparent Scalability: 1,500 nodes, PB data and a trillion rows of records in one cluster.
  • Ultra-fast Performance: TPC-C 707 million tmpC and TPC-H 15.26 million QphH @30000GB.
  • Cost Efficiency: saves 70%–90% of storage costs.
  • Real-time Analytics: supports HTAP without additional cost.
  • Continuous Availability: RPO = 0(zero data loss) and RTO < 8s(recovery time)
  • MySQL Compatible: easily migrated from MySQL database.

See also key features for more details.

Quick start

See also Quick experience or Quick Start (Simplified Chinese) for more details.

🔥 Start with all-in-one

You can quickly deploy a stand-alone OceanBase Database to experience with the following commands:

Note: Linux Only

# download and install all-in-one package (internet connection is required)
bash -c "$(curl -s https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/oceanbase-all-in-one/installer.sh)"
source ~/.oceanbase-all-in-one/bin/env.sh

# quickly deploy OceanBase database
obd demo

🐳 Start with docker

Note: We provide images on dockerhub, quay.io and ghcr.io. If you have problems pulling images from dockerhub, please try the other two registries.

  1. Start an OceanBase Database instance:

    # Deploy a mini standalone instance.
    docker run -p 2881:2881 --name oceanbase-ce -e MODE=mini -d oceanbase/oceanbase-ce
    
    # Deploy a mini standalone instance using image from quay.io.
    # docker run -p 2881:2881 --name oceanbase-ce -e MODE=mini -d quay.io/oceanbase/oceanbase-ce
    
    # Deploy a mini standalone instance using image from ghcr.io.
    # docker run -p 2881:2881 --name oceanbase-ce -e MODE=mini -d ghcr.io/oceanbase/oceanbase-ce
  2. Connect to the OceanBase Database instance:

    docker exec -it oceanbase-ce obclient -h127.0.0.1 -P2881 -uroot # Connect to the root user of the sys tenant.

See also Docker Readme for more details.

☸️ Start with Kubernetes

You can deploy and manage OceanBase Database instance in kubernetes cluster with ob-operator quickly. Refer to the document Quick Start for ob-operator to see details.

👨‍💻 Start developing

See OceanBase Developer Document to learn how to compile and deploy a manually compiled observer.

Roadmap

For future plans, see Product Iteration Progress. See also OceanBase Roadmap for more details.

Case study

OceanBase has been serving more than 1000 customers and upgraded their database from different industries, including Financial Services, Telecom, Retail, Internet, and more.

See also success stories and Who is using OceanBase for more details.

System architecture

Introduction to system architecture

Contributing

Contributions are highly appreciated. Read the development guide to get started.

License

OceanBase Database is licensed under the Mulan Public License, Version 2. See the LICENSE file for more info.

Community

Join the OceanBase community via:

obconnector-j's People

Contributors

ob-robot-pre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

obconnector-j's Issues

[Bug]: 高并发下getCachedSql报java.lang.ClassCastException

Describe the bug

报错信息:
Suppressed: java.lang.ClassCastException: java.util.LinkedHashMap$Entry cannot be cast to java.util.HashMap$TreeNode at java.util.HashMap$TreeNode.moveRootToFront(HashMap.java:1835) ~[?:1.8.0_242] at java.util.HashMap$TreeNode.treeify(HashMap.java:1951) ~[?:1.8.0_242] at java.util.HashMap.treeifyBin(HashMap.java:772) ~[?:1.8.0_242] at java.util.HashMap.putVal(HashMap.java:644) ~[?:1.8.0_242] at java.util.HashMap.put(HashMap.java:612) ~[?:1.8.0_242] at com.oceanbase.jdbc.OceanBaseConnection.getCachedSql(OceanBaseConnection.java:612) ~[oceanbase-client-2.4.1.jar!/:?] at com.oceanbase.jdbc.OceanBaseConnection.internalPrepareStatement(OceanBaseConnection.java:643) ~[oceanbase-client-2.4.1.jar!/:?] at com.oceanbase.jdbc.OceanBaseConnection.prepareStatement(OceanBaseConnection.java:438) ~[oceanbase-client-2.4.1.jar!/:?] at com.p6spy.engine.wrapper.ConnectionWrapper.prepareStatement(ConnectionWrapper.java:118) ~[p6spy-3.7.0.jar!/:?] at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:337) ~[HikariCP-4.0.3.jar!/:?] at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java) ~[HikariCP-4.0.3.jar!/:?] at org.springframework.jdbc.core.JdbcTemplate$SimplePreparedStatementCreator.createPreparedStatement(JdbcTemplate.java:1556) ~[spring-jdbc-5.2.24.RELEASE.jar!/:5.2.24.RELEASE] at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:615) ~[spring-jdbc-5.2.24.RELEASE.jar!/:5.2.24.RELEASE] at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:669) ~[spring-jdbc-5.2.24.RELEASE.jar!/:5.2.24.RELEASE] at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:700) ~[spring-jdbc-5.2.24.RELEASE.jar!/:5.2.24.RELEASE] at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:753) ~[spring-jdbc-5.2.24.RELEASE.jar!/:5.2.24.RELEASE]

Environment

版本:oceanbase-client-2.4.1.jar

Fast reproduce steps

频繁查询即可触发

Expected behavior

No response

Actual behavior

No response

Additional context

No response

[Bug]: getTables returns values like '[B@625dc005' for REMARK column

Describe the bug

When using the driver without the useInformationSchema option the getTables REMARK column returns
the result of new byte[0].toString(); which results in values like [B@78aab498

Environment

For any version of the obconnector-j, I used 2.4.10
For any JDBC SQL client, I used sqlline

Fast reproduce steps

JDBC Connection string without the useInformationSchema option.

Expected behavior

sqlline> !connect jdbc:oceanbase://172.16.4.198:2881/db1

0: jdbc:oceanbase://172.16.4.198:2881/db1> !tables
+-----------+-------------+------------+------------+-------------+----------+------------+-----------+---------------------------+----------------+
| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE |   REMARKS   | TYPE_CAT | TYPE_SCHEM | TYPE_NAME | SELF_REFERENCING_COL_NAME | REF_GENERATION |
+-----------+-------------+------------+------------+-------------+----------+------------+-----------+---------------------------+----------------+
| db1       |             | results    | TABLE      |             |          |            |           |                           |                |
| db1       |             | stuff      | TABLE      |             |          |            |           |                           |                |
| db1       |             | zot        | TABLE      |             |          |            |           |                           |                |
+-----------+-------------+------------+------------+-------------+----------+------------+-----------+---------------------------+----------------+

Actual behavior

sqlline> !connect jdbc:oceanbase://172.16.4.198:2881/db1

0: jdbc:oceanbase://172.16.4.198:2881/db1> !tables
+-----------+-------------+------------+------------+-------------+----------+------------+-----------+---------------------------+----------------+
| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE |   REMARKS   | TYPE_CAT | TYPE_SCHEM | TYPE_NAME | SELF_REFERENCING_COL_NAME | REF_GENERATION |
+-----------+-------------+------------+------------+-------------+----------+------------+-----------+---------------------------+----------------+
| db1       |             | results    | TABLE      | [B@33afa13b |          |            |           |                           |                |
| db1       |             | stuff      | TABLE      | [B@56a6d5a6 |          |            |           |                           |                |
| db1       |             | zot        | TABLE      | [B@18ce0030 |          |            |           |                           |                |
+-----------+-------------+------------+------------+-------------+----------+------------+-----------+---------------------------+----------------+

Additional context

The line that produces the invalid column values in version 2.4.10 is
JDBC4DatabaseMetaData.java:1014
data[4] = new byte[0].toString();

[Feature]: Support Go Client

Describe your use case

OceanBase Client for Go

Describe the solution you'd like

Just curious if OB has any plan to develop a client in Go.
As more and more developers are using Golang to develop applicaations, Java and C/C++ drivers are far from enough.

And Oracle, for example, has go-ora driver, which can be added to the Go application:

Describe alternatives you've considered

No response

Additional context

No response

[Bug]: 海量数据查询报OOM错误

Describe the bug

通过jdbc oracle企业版在查询海量数据的时候,如1亿以上,报OOM。同样代码在ORACLE下无问题,部分代码如下:
stmt = conn.prepareStatement(sql,
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
stmt.setFetchDirection(ResultSet.FETCH_FORWARD);
stmt.setFetchSize(1000);
rs = stmt.executeQuery(); // 内存溢出

Environment

驱动版本2.4.3

Fast reproduce steps

/

Expected behavior

No response

Actual behavior

No response

Additional context

No response

[Bug]: failed to connect to server when client timezone is UTC

Describe the bug

When I run a java code to connect to Oceanbase and I set the default time zone to UTC or GMT+00:00, an exception will be throwed:

Failed to establish a connection: Could not connect to *****:2881 : (conn=3221584558) The server time_zone 'GMT+08:00' defined in the 'serverTimezone' parameter cannot be parsed by java TimeZone implementation. See java.util.TimeZone#getAvailableIDs() for available TimeZone, depending on your JRE implementation.
java.sql.SQLTransientConnectionException: Could not connect to ******:2881 : (conn=3221584558) The server time_zone 'GMT+08:00' defined in the 'serverTimezone' parameter cannot be parsed by java TimeZone implementation. See java.util.TimeZone#getAvailableIDs() for available TimeZone, depending on your JRE implementation.
        at com.oceanbase.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:128)
        at com.oceanbase.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:235)
        at com.oceanbase.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1644)
        at com.oceanbase.jdbc.internal.util.Utils.retrieveProxy(Utils.java:1427)
        at com.oceanbase.jdbc.OceanBaseConnection.newConnection(OceanBaseConnection.java:306)
        at com.oceanbase.jdbc.Driver.connect(Driver.java:89)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229)
        at com.example.apecloud.DatabaseManager.getConnection(DatabaseManager.java:67)
        at com.example.apecloud.DatabaseManager.testConnection(DatabaseManager.java:39)
        at com.example.Main.getConn(Main.java:159)
        at com.example.Main.main(Main.java:42)

Environment

Mac and Java.

Fast reproduce steps

String tz = "GMT" + "+00:00";
TimeZone timeZone = Utils.getTimeZone(tz);
TimeZone.setDefault(timeZone);
String host=1.2.3.4
String jdbcUrl = "jdbc:oceanbase://" + host + ":2881/TEST?serverTimezone=Asia/Shanghai";
String username = "TEST@test";
String password = "123455";
return DriverManager.getConnection(jdbcUrl, username, password);

Expected behavior

Connect to the Oceanbase successfully.

Actual behavior

Throw exception.

Additional context

I analyzed the source code, and I believe the issue lies within the sendAlterSessionTimezone function.

    private void sendAlterSessionTimezone() throws IOException, SQLException {
        this.importedTimeZoneTables = getServerTZTablesImported();
        String zoneId = this.importedTimeZoneTables ? TimeZone.getDefault().getID()
            : TimeZone.getDefault().toZoneId().getRules().getStandardOffset(Instant.now()).getId();
        // when importedTimeZoneTables is
        //   false: the TIME_ZONE cannot be set to any values that start with "GMT"
        //   true: only GMT, GMT+0, GMT-0, GMT0 can be accepted
        if (zoneId.startsWith("GMT") && (!this.importedTimeZoneTables
                || !zoneId.equalsIgnoreCase("GMT")|| !zoneId.equalsIgnoreCase("GMT+0")
                || !zoneId.equalsIgnoreCase("GMT-0") || !zoneId.equalsIgnoreCase("GMT0"))) {
            zoneId = zoneId.substring("GMT".length());
        }

        writer.startPacket(0);
        writer.write(Packet.COM_QUERY);
        writer.write(ALTER_SESSION_TIMEZONE_QUERY);
        writer.write(zoneId.getBytes());
        writer.write('\'');
        writer.flush();
    }

When the default timezone is UTC, the TimeZone.getDefault().toZoneId().getRules().getStandardOffset(Instant.now()).getId() will return Z, and Z is not a valid timezone for alter session set TIME_ZONE that will throw an exception, unfortunately, this exception message is not been printed, so it is difficult to clearly see where the problem lies.

IMO, this function should check if the zoneId is Z, if yes, convert it to a valid timezone format.

[Bug]: JDBC查询BINARY_FLOAT类型时出错

Describe the bug

create table T4(ID BINARY_FLOAT);
insert into T4 values(1.2);

然后通过jdbc 使用select 查询这个表,当调用resultSet.getObject()方法时驱动会报错,驱动用的oceanbase-client:2.4.3
错误的位置在下面截图这里:
image
这里直接new String(bytes) 没看懂..

下面用Float.intBitsToFloat转换能正常显示出插入值 1.2
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.