fix(connector): fix Oracle database connection URL build and password…#509
Open
tfgzs wants to merge 1 commit intospring-ai-alibaba:mainfrom
Open
fix(connector): fix Oracle database connection URL build and password…#509tfgzs wants to merge 1 commit intospring-ai-alibaba:mainfrom
tfgzs wants to merge 1 commit intospring-ai-alibaba:mainfrom
Conversation
… serialization - Fix Oracle JDBC URL construction by extracting serviceName from databaseName field (format: 'serviceName|schemaName' -> use only 'serviceName' for URL) - Change password field from @JsonIgnore to @JsonProperty(WRITE_ONLY) to allow receiving password from frontend while not exposing it in responses - Add password validation before connection test to fail fast with clear error Fixes Oracle connection issues: - ORA-01005: null password given; logon denied - Invalid JDBC URL with schema name included
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix Oracle Database Connection Issues
📖 Summary
Fixed two critical bugs preventing Oracle database connections from working:
@JsonIgnoreannotation🐛 Problems Fixed
Issue 1: Oracle JDBC URL Build Error
Symptom:
Root Cause:
databaseNamefield stores format:serviceName|schemaName(e.g.,BOSNDS3|BOSNDS3_ADMIN)OracleDatasourceTypeHandler.buildConnectionUrl()directly used the entire fieldSolution:
Extract only the
serviceNamepart (before|) when building the JDBC URL, while preserving the full field for schema extraction later.Issue 2: Password Field Cannot Be Saved
Symptom:
Root Cause:
Datasource.passwordfield used@JsonIgnoreannotationSolution:
Changed from
@JsonIgnoreto@JsonProperty(access = JsonProperty.Access.WRITE_ONLY):🔧 Changes Made
1. OracleDatasourceTypeHandler.java
File:
data-agent-management/src/main/java/com/alibaba/cloud/ai/dataagent/service/datasource/handler/impl/OracleDatasourceTypeHandler.java2. Datasource.java
File:
data-agent-management/src/main/java/com/alibaba/cloud/ai/dataagent/entity/Datasource.java3. DatasourceServiceImpl.java
File:
data-agent-management/src/main/java/com/alibaba/cloud/ai/dataagent/service/datasource/impl/DatasourceServiceImpl.javaAdded password validation before connection test:
✅ How to Test
Test Oracle Connection
localhost(or your Oracle host)1521(Oracle default port)serviceName|schemaName(e.g.,BOSNDS3|BOSNDS3_ADMIN)Verify Password Security
📝 Special Notes
For Reviewers
Security Consideration: The
@JsonProperty(WRITE_ONLY)approach is the standard Jackson pattern for password fields. It ensures:@JsonIgnorewhich prevents both operationsBackward Compatibility:
Oracle URL Format:
jdbc:oracle:thin:@host:port/serviceNameTesting Checklist
🔗 Related Issues
Fixes connection errors:
ORA-01005: null password given; logon deniedGetConnectionTimeoutExceptionwith invalid Oracle URL format📚 Documentation References