choucmei opened a new issue #6628:
URL: https://github.com/apache/dolphinscheduler/issues/6628


   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   when i use  script/create-dolphinscheduler.sh to create init database 
'dolphinscheduler2', i got this exception. 
   
   08:58:12.170 [main] ERROR org.apache.dolphinscheduler.dao.upgrade.UpgradeDao 
- Table 'dolphinscheduler2.t_ds_version' doesn't exist
   java.sql.SQLSyntaxErrorException: Table 'dolphinscheduler2.t_ds_version' 
doesn't exist
        at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
        at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
        at 
com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
        at 
com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:955)
        at 
com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1005)
        at 
com.alibaba.druid.pool.DruidPooledPreparedStatement.executeQuery(DruidPooledPreparedStatement.java:227)
        at 
org.apache.dolphinscheduler.dao.upgrade.UpgradeDao.getCurrentVersion(UpgradeDao.java:246)
        at 
org.apache.dolphinscheduler.dao.upgrade.DolphinSchedulerManager.upgradeDolphinScheduler(DolphinSchedulerManager.java:101)
        at 
org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler.main(CreateDolphinScheduler.java:41)
   08:58:12.172 [main] DEBUG com.alibaba.druid.pool.PreparedStatementPool - 
stmt exit cache
   08:58:12.172 [main] ERROR 
org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler - create 
DolphinScheduler failed
   java.lang.RuntimeException: sql: select version from t_ds_version
        at 
org.apache.dolphinscheduler.dao.upgrade.UpgradeDao.getCurrentVersion(UpgradeDao.java:256)
        at 
org.apache.dolphinscheduler.dao.upgrade.DolphinSchedulerManager.upgradeDolphinScheduler(DolphinSchedulerManager.java:101)
        at 
org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler.main(CreateDolphinScheduler.java:41)
   Caused by: java.sql.SQLSyntaxErrorException: Table 
'dolphinscheduler2.t_ds_version' doesn't exist
        at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
        at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
        at 
com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
        at 
com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:955)
        at 
com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1005)
        at 
com.alibaba.druid.pool.DruidPooledPreparedStatement.executeQuery(DruidPooledPreparedStatement.java:227)
        at 
org.apache.dolphinscheduler.dao.upgrade.UpgradeDao.getCurrentVersion(UpgradeDao.java:246)
        ... 2 common frames omitted
   
   Process finished with exit code 0
   
   
   ### What you expected to happen
   
   got success.
   
   ### How to reproduce
   
   because i didn't drop old database 'dolphinscheduler ',and sametimes i want 
to create database 'dolphinscheduler2'.
   
   org.apache.dolphinscheduler.dao.upgrade.MysqlUpgradeDao#isExistsTable 
   this method just check table exists, didn't specify the database.
   if other database contains same table of name, it got true from this method.
   
   conn.getMetaData().getTables(null, null, tableName, null);
   
   this should specify catalog and schema .
   
   org.apache.dolphinscheduler.dao.upgrade.MysqlUpgradeDao#isExistsColumn this 
method sames too.
   
   ### Anything else
   
   And this BUG maybe exists in postgreSQL. i will check soon
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to