Chris-Arith opened a new issue, #12214:
URL: https://github.com/apache/dolphinscheduler/issues/12214

   ### 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 add an oracle datasource to DS, it will report an error when I choose 
to connnect a database that are different with the username.
   It has no problem in MySQL because we can assign a database through the 
jdbcurl.
   But for oracle, we can only use the same according to the instance name and 
choose database manually.
   I check out the source code and found that schema gets value from  
`schemaPattern = connectionParam.getUser();` at 
`org.apache.dolphinscheduler.api.service.impl.DataSourceServiceImpl#getDbSchemaPattern`,
 it will only use `username` as the schema, so we can only access one database.
   I suggest we add a select option to choose which database we want to use or 
we can point out schema in `jdbc connect parameters` when we add datasouce, and 
we can modify code like this
   ```java
   case ORACLE:
       Map<String, String> props = connectionParam.getProps();
       String tempSchema = props.get(Constants.SCHEMA);
       schemaPattern = StringUtils.isEmpty(tempSchema) ? 
connectionParam.getUser() : tempSchema;
       if (null != schemaPattern) {
           schemaPattern = schemaPattern.toUpperCase();
       }
       break;
   case SQLSERVER:
   ```
   Then we can add datasource like this
   
![image](https://user-images.githubusercontent.com/48941586/193026514-c671c640-3a25-4180-b523-5d9c202354c6.png)
   
   when users appoint a shema, we use it, otherwise we use the default one.
   
   ### What you expected to happen
   
   we can choose databases other than the default one
   
   ### How to reproduce
   
   use database different from username
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   3.0.x
   
   ### 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