Comments (10)
@prefect1005 So did you configured database db2
and create (or load) table2 in it?
from shardingsphere.
@RaigorJiang Of course .
in other word, if one project need to select db1 and db2 database, just db1.table1 need sharding config,so how to config that we can execute db2`s sql correcttly
from shardingsphere.
@RaigorJiang Of course . in other word, if one project need to select db1 and db2 database, just db1.table1 need sharding config,so how to config that we can execute db2`s sql correcttly
Create two logic databases, named db1 and db2.
from shardingsphere.
@RaigorJiang im sorry that i used "ShardingSphere-JDBC", and i dont know how to create logic databases, can you give me one demo or config file ? thank you.
from shardingsphere.
i try to config like this, but it not used
from shardingsphere.
@prefect1005
OK, so you just want to access tables in multiple data sources, not multiple logic data bases.
let's do two things:
- Configure single rule
*.*
; (link) - Use table name directly when executing SQL (select * from table2)
Note that this only applies to the case where there are no tables with the same name in data source 1 and data source 2.
from shardingsphere.
well, i got it.
in my project, every sql has point db, like 'select * from db1.table1'
in this case, its not work until i config 'databaseName:db1' let
s coding not used default databaseName - 'logic_db'
and then, other sql 'select * from db2.table2' will execute wrong because that dbMap not containskey 'db2'.
so it well success after i delete all point database(and config db1/db2 datasource both, eventhough all database in the same entity database(same ip and port)).
but in this way, the code will confusion because i can`t recognize the table from which db directtly .
finally, Is there a plan to support the SQL that point db like 'select * from db3.table3'?
from shardingsphere.
+1 ,this scenario is very common.
well, i got it. in my project, every sql has point db, like 'select * from db1.table1' in this case, it
s not work until i config 'databaseName:db1' let
s coding not used default databaseName - 'logic_db' and then, other sql 'select * from db2.table2' will execute wrong because that dbMap not containskey 'db2'. so it well success after i delete all point database(and config db1/db2 datasource both, eventhough all database in the same entity database(same ip and port)). but in this way, the code will confusion because i can`t recognize the table from which db directtly . finally, Is there a plan to support the SQL that point db like 'select * from db3.table3'?
from shardingsphere.
@prefect1005 @6z7
It is possible that duplicate beanName for multiple datasources causes the datasource to not load,like db2 is used db1 datasource。
from shardingsphere.
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
from shardingsphere.
Related Issues (20)
- The reason message of FileIOException is inaccurate
- How to support SQLServer dml encrypt with schema HOT 1
- JDBCRepositorySQLLoader native-image之后 loadFromDirectory方法,虽然进行了文件系统的创建,如果存在抛出java.nio.file.FileSystemAlreadyExistsException异常,没有考虑 HOT 2
- As of merge #30321, integration tests fail on GraalVM Native Image HOT 1
- Why ShardingSphere-JDBC take over all SQL although the tables not in spring.shardingsphere.sharding.tables config? HOT 1
- Parse Engine So weak HOT 7
- Support parsing Oracle SPOOL sql
- The issue of returning a short path when ClasspathResourceDirectoryReader reading a nested directory.
- Data is not maked when Function is used HOT 2
- The parsing result does not match the expected result when using keywords as field names HOT 1
- How can I build a FatJar for shardingsphere-jdbc and use it correctly ? HOT 10
- SQL with a projected column of boolean type cannot be executed in federated queries
- When using SQL Server for the database, the paging plugin pageHelper cannot page properly HOT 4
- postgresql does not support other schema name,just can be public HOT 1
- SystemSchemaManager init error.
- Consider refactoring Combine Statement SQL parsing logic and parsing statement HOT 1
- The railroad diagram blocked? HOT 3
- though setted keyGenerators SNOWFLAKE,but id is not setted HOT 7
- Some SQLServer parse test case failed when add EOF in SQLServerStatement.g4
- Missing Unit Test in `SQLParserEngine` class
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shardingsphere.