Skip to content

Refactor connections to use AS400 object - #150

Merged
ThePrez merged 2 commits into
mainfrom
refactor-connections
May 26, 2026
Merged

Refactor connections to use AS400 object#150
ThePrez merged 2 commits into
mainfrom
refactor-connections

Conversation

@julesyan

Copy link
Copy Markdown
Collaborator

Work for #134

Signed-off-by: Julia Yan <julia.yan@ibm.com>
@julesyan
julesyan requested a review from ThePrez May 26, 2026 15:25

@ThePrez ThePrez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with comments

AS400JDBCDriver driver = new AS400JDBCDriver();

// Determine the database name based on connection method
String databaseName = "*LOCAL";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Target database name is an oversight in the original design, but made very visible here in this refactor.

We should do one of the following:

  • Add databaseName as an input parameter to this function and refactor all callers to use the database name provided on the "connect" option in the JSON request (that option doesn't exist yet, so this becomes a new feature)
  • Open an issue to track the proper implementation of database name

I suggest the issue, and we can handle that when we add proper Kerberos support

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ope.... one can use the database name JDBC property to connect to the IASP which should work in current design. Should we just use null here? (@jeber-ibm ?)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "database name" JDBC property should only be used when connecting to an IASP. It cannot be used to connect to a RDB that is not an IASP.

// Determine the database name based on connection method
String databaseName = "*LOCAL";
if (!isRunningOnIBMi() || _connectionMethod == ConnectionMethod.TCP) {
databaseName = systemName;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this special case check is needed but am not sure. (@jeber-ibm ?)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check may not work, depending on how the system is configured. Don't use the databaseName unless you are connecting to an IASP.

Signed-off-by: Julia Yan <julia.yan@ibm.com>
@julesyan

Copy link
Copy Markdown
Collaborator Author

@ThePrez I have removed the check and instead passed in null since we may not be using an IASP

@julesyan
julesyan requested a review from ThePrez May 26, 2026 16:04
@julesyan
julesyan marked this pull request as ready for review May 26, 2026 16:04
@julesyan julesyan linked an issue May 26, 2026 that may be closed by this pull request
@ThePrez
ThePrez merged commit a13ab99 into main May 26, 2026
3 checks passed
@ThePrez
ThePrez deleted the refactor-connections branch May 26, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kerberos support in server

3 participants