You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "static0807 (via GitHub)" <gi...@apache.org> on 2023/07/07 09:32:11 UTC

[GitHub] [shardingsphere] static0807 opened a new issue, #26815: when i use shardingsphere proxy with postgresql , how to switch database in jdbc

static0807 opened a new issue, #26815:
URL: https://github.com/apache/shardingsphere/issues/26815

   ## Question
   
   my shardingsphere version is 5.3.2
   
   because i want to dynamically refresh the encrypt rule by settings. so i try to use the distsql refresh the rules in my program.
   
   I use jdbc to connect to postgreSQL through proxy,
   
   first,i create logic database, so i execute "create database xxx",
   
   second, i want to register storage unit , i want switch to the new database, so i execute "USE XXX", but an error occurred.
   
   Exception in thread "main" org.postgresql.util.PSQLException: ERROR: You have an error in your SQL syntax: USE test_pg, no viable alternative at input 'USE' at line 1, position 0, near [@0,0:2='USE',<589>,1:0]
   
   i change to execute "\c xxx", but it also error.
   
   Exception in thread "main" org.postgresql.util.PSQLException: ERROR: You have an error in your SQL syntax: \c test_pg, no viable alternative at input '\' at line 1, position 0, near [@0,0:0='\',<17>,1:0]
   
   so, when i use jdbc  connect shardingsphere proxy, how i switch to other database on postgresql
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on issue #26815: when i use shardingsphere proxy with postgresql , how to switch database in jdbc

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #26815:
URL: https://github.com/apache/shardingsphere/issues/26815#issuecomment-1630297980

   @static0807 In addition, what is the reason for `re-create the data source connection using the new database, this is impossible without a storage unit .` you described?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] when i use shardingsphere proxy with postgresql , how to switch database in jdbc [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #26815: when i use shardingsphere proxy with postgresql , how to switch database in jdbc
URL: https://github.com/apache/shardingsphere/issues/26815


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] github-actions[bot] commented on issue #26815: when i use shardingsphere proxy with postgresql , how to switch database in jdbc

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #26815:
URL: https://github.com/apache/shardingsphere/issues/26815#issuecomment-1673838151

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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] static0807 commented on issue #26815: when i use shardingsphere proxy with postgresql , how to switch database in jdbc

Posted by "static0807 (via GitHub)" <gi...@apache.org>.
static0807 commented on issue #26815:
URL: https://github.com/apache/shardingsphere/issues/26815#issuecomment-1627904750

   hi,@Raigorjiang
   
   I tried it . 
   
   First, i create a logic database. and then,i want to register a storage unit. so i must switch  the new logic database.
   
   And i tried to connect to the new logic database without a storage unit, but it failed.
   
   so i must switch to the new logic database first. 
   
   What should I do with jdbc


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on issue #26815: when i use shardingsphere proxy with postgresql , how to switch database in jdbc

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #26815:
URL: https://github.com/apache/shardingsphere/issues/26815#issuecomment-1627616753

   Hi @static0807 ,
   According to the PostgreSQL protocol, you need to re-create the data source connection using the new database(with new jdbc url) after creating it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on issue #26815: when i use shardingsphere proxy with postgresql , how to switch database in jdbc

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #26815:
URL: https://github.com/apache/shardingsphere/issues/26815#issuecomment-1630296138

   > hi,@RaigorJiang
   > 
   > I tried it .
   > 
   > re-create the data source connection using the new database, this is impossible without a storage unit .
   > 
   > but, when i try to register a storage unit, i must switch to the new logic database. but the "\c " is disabled in jdbc.
   > 
   > and in your doc, It also indicates that must switch to the new logic dabase first, then we can register storage unit.
   > 
   > ![image](https://user-images.githubusercontent.com/72844024/252187518-f48f2cc7-d2ea-4528-8d9a-5d0d2b81d99a.png)
   > 
   > What should I do with jdbc
   
   @static0807 Sorry, this description is for the MySQL protocol. (Proxy only supported MySQL at the earliest)
   
   I will submit the function of registering storage units outside the logic database in the near future (shared storage units, each logic database can use them), maybe this will solve your problem?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org