apache / shardingsphere

Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database.
Apache License 2.0
19.76k stars 6.69k forks source link

configure database-encrypt.yaml but failed to insert #32241

Closed daydayuphere closed 4 weeks ago

daydayuphere commented 1 month ago
  1. I prepared table (lsh_test). image

  2. config database-encrypt.yaml like this:

    databaseName: postgres

dataSources: postgres: url: jdbc:postgresql://192.168.2.199:5432/postgres username: postgres password: 123456 connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 50 minPoolSize: 1

rules:

3.try to insert new record with SQl "INSERT INTO lsh_test (username) VALUES ('abolish')", but failed

what's wrong?

daydayuphere commented 1 month ago

test code

import psycopg2

dbname = "postgres" host = "192.168.2.199" port = "13308" user = "root" password = "root"

conn = psycopg2.connect(dbname=dbname, user=user, password=password, host=host, port=port) cur = conn.cursor()

insert_sql = """ INSERT INTO lsh_test (username) VALUES ('abolish'); """

cur.execute(insert_sql) records = cur.fetchall() for record in records: print(record)

cur.close() conn.close()


test result

Traceback (most recent call last): File "D:\Code\pythonProject5\psql.py", line 31, in records = cur.fetchall() ^^^^^^^^^^^^^^ psycopg2.ProgrammingError: no results to fetch

terrymanu commented 1 month ago

What is your version?

daydayuphere commented 1 month ago

apache/shardingsphere-proxy:latest psql (PostgreSQL) 14.1

daydayuphere commented 1 month ago

docker logs, no error reported

we find java version: java21, full_version=21.0.3, full_path=/opt/java/openjdk/bin/java unadapted java version, please notice... The port is 3308 The classpath is /opt/shardingsphere-proxy/conf:.:/opt/shardingsphere-proxy/lib/:/opt/shardingsphere-proxy/ext-lib/ main class org.apache.shardingsphere.proxy.Bootstrap 3308 /opt/shardingsphere-proxy/conf 0.0.0.0 false [INFO ] 2024-07-24 05:22:29.446 [main] o.a.s.d.p.c.l.PipelineContextManagerLifecycleListener - mode type is not Cluster, mode type='Standalone', ignore [INFO ] 2024-07-24 05:22:29.468 [main] o.a.s.p.v.ShardingSphereProxyVersion - Database type is PostgreSQL, version is 14.1 (Debian 14.1-1.pgdg110+1), database name is postgres [INFO ] 2024-07-24 05:22:29.469 [main] o.a.s.p.frontend.ssl.ProxySSLContext - Proxy frontend SSL/TLS is not enabled. [INFO ] 2024-07-24 05:22:29.553 [main] o.a.s.p.frontend.ShardingSphereProxy - ShardingSphere-Proxy Standalone mode started successfully

terrymanu commented 1 month ago

What happen when insert failed?

daydayuphere commented 1 month ago

why failed? My config and steps is right?

terrymanu commented 1 month ago

Firstly, we need to know what happen when failed, and then we can try to analyze cause.

github-actions[bot] commented 4 weeks ago

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.