Created
February 15, 2025 10:23
-
-
Save muhdkhokhar/6efaa31f13dc6253ac730e87fd13af46 to your computer and use it in GitHub Desktop.
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
private int getSessionId(Connection connection) throws Exception { | |
try (PreparedStatement ps = connection.prepareStatement("SELECT @@SPID"); | |
ResultSet rs = ps.executeQuery()) { | |
if (rs.next()) { | |
return rs.getInt(1); | |
} | |
} | |
throw new RuntimeException("Failed to retrieve session ID."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment