Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] Add connection properties to use proxy server like proxyHost and proxyPort #1788

Open
rikat-ms opened this issue Apr 4, 2022 · 5 comments
Labels
Enhancement An enhancement to the driver. Lower priority than bugs.
Projects

Comments

@rikat-ms
Copy link

rikat-ms commented Apr 4, 2022

Is your feature request related to a problem? If so, please give a short summary of the problem and how the feature would resolve it

Using socketFactoryClass option introduced in Microsoft JDBC Driver 8.4 enables users to connect to SQL Server via a proxy server. This is useful only for developers who develop own Java applications, but this doesn't help users to use the third-party applications with JDBC driver because such applications accept only connection string and don't provide opportunities to implement custom socket class. In this case, users have to change system proxyHost/proxyPort setting if possible or ask the third-party application providers to implement custom socket factory.

Describe the preferred solution

As using proxy servers is very common recently, it would be helpful for users if JDBC driver could have options for proxy like proxyhost and proxyport as the connection properties.

Reference Documentations/Specifications

https://docs.microsoft.com/en-us/sql/connect/jdbc/setting-the-connection-properties?view=sql-server-ver15
#1223

@tkyc tkyc added the Enhancement An enhancement to the driver. Lower priority than bugs. label Apr 5, 2022
@lilgreenbird lilgreenbird removed the Enhancement An enhancement to the driver. Lower priority than bugs. label Apr 5, 2022
@lilgreenbird
Copy link
Member

hi @rikat-ms

Java supports proxies via the https.proxyHost and https.proxyPort system properties:

https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html

These settings get used by the underlying libraries in MSAL4J. There isn’t anything needed in the JDBC driver to propagate those down.

@microsoft microsoft deleted a comment from tkyc Apr 5, 2022
@lilgreenbird lilgreenbird added this to Under Investigation in MSSQL JDBC via automation Apr 5, 2022
@lilgreenbird lilgreenbird moved this from Under Investigation to Waiting for Customer in MSSQL JDBC Apr 5, 2022
@rikat-ms
Copy link
Author

rikat-ms commented Apr 5, 2022

Hi @lilgreenbird, Thank you for your comment. I think it's not "https.proxyHost" but socksProxyHost because SQL Connectivity uses Socket. JRE-wide settings would help as you mentioned and as I wrote "In this case, users have to change system proxyHost/proxyPort setting". However, this request is for the scenario users want to use "socketFactoryClass" option instead.

@lilgreenbird lilgreenbird added the Enhancement An enhancement to the driver. Lower priority than bugs. label Apr 6, 2022
@lilgreenbird lilgreenbird moved this from Waiting for Customer to Backlog in MSSQL JDBC Apr 6, 2022
@lilgreenbird
Copy link
Member

I apologize you are correct. I have added this feature request to our backlog it will be triaged along with other feature requests when we plan for the next semester. Thanks.

@ecki
Copy link
Contributor

ecki commented Nov 27, 2023

I think the easiest would be to add a factory which then can be used with the mentioned connectionFactoryClass attribute (as it exists in the classpath). That class can then configure a proxy selector and use normal SocketImpl. I wonder if there is an syntax to configure proxy from a string (property).

@ash211
Copy link

ash211 commented Feb 2, 2024

This would be helpful for me, to match the functionality that Oracle's JDBC driver offers: https://docs.oracle.com/en/database/oracle/oracle-database/23/jjdbc/data-sources-and-URLs.html#GUID-8D0ADAE6-B8EF-4E02-85E3-15C2509ACBD8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement An enhancement to the driver. Lower priority than bugs.
Projects
MSSQL JDBC
  
Backlog
Development

No branches or pull requests

5 participants