Giter Site home page Giter Site logo

Cause: org.apache.shardingsphere.infra.exception.TableNotExistsException: Table or view `***` does not exist. about shardingsphere HOT 10 OPEN

prefect1005 avatar prefect1005 commented on May 20, 2024
Cause: org.apache.shardingsphere.infra.exception.TableNotExistsException: Table or view `***` does not exist.

from shardingsphere.

Comments (10)

RaigorJiang avatar RaigorJiang commented on May 20, 2024

@prefect1005 So did you configured database db2 and create (or load) table2 in it?

from shardingsphere.

prefect1005 avatar prefect1005 commented on May 20, 2024

@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 avatar RaigorJiang commented on May 20, 2024

@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.

prefect1005 avatar prefect1005 commented on May 20, 2024

@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.

prefect1005 avatar prefect1005 commented on May 20, 2024

image
i try to config like this, but it not used

from shardingsphere.

RaigorJiang avatar RaigorJiang commented on May 20, 2024

@prefect1005
OK, so you just want to access tables in multiple data sources, not multiple logic data bases.
let's do two things:

  1. Configure single rule *.*; (link)
  2. 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.

prefect1005 avatar prefect1005 commented on May 20, 2024

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' lets 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.

6z7 avatar 6z7 commented on May 20, 2024

+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, its not work until i config 'databaseName:db1' lets 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.

vaqsummer avatar vaqsummer commented on May 20, 2024

@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.

github-actions avatar github-actions commented on May 20, 2024

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)

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.