[ 
https://issues.apache.org/jira/browse/FLINK-38616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hongshun Wang updated FLINK-38616:
----------------------------------
    Description: 
In DriverManager, we can pass the jdbc properties into a connection, which is 
more flexible.
{code:java}
@CallerSensitive
public static Connection getConnection(String url,
    java.util.Properties info) throws SQLException {

    return (getConnection(url, info, Reflection.getCallerClass()));
} {code}
 

For example, in [postgres 
document|https://jdbc.postgresql.org/documentation/use/]:

 
{code:java}
String url = "jdbc:postgresql://localhost/test";
Properties props = new Properties();
props.setProperty("user", "fred");
props.setProperty("password", "secret");
props.setProperty("ssl", "true");
Connection conn = DriverManager.getConnection(url, props); {code}
 

 

 

Currently ,in jdbc catalog, only username and password is passed( other jdbc 
properties is not provided.
{code:java}
@Override
public CatalogBaseTable getTable(ObjectPath tablePath)
        throws TableNotExistException, CatalogException {

    if (!tableExists(tablePath)) {
        throw new TableNotExistException(getName(), tablePath);
    }

    String databaseName = tablePath.getDatabaseName();
    String dbUrl = baseUrl + databaseName;

    try (Connection conn = DriverManager.getConnection(dbUrl, username, pwd)) {
////
} {code}
Why not pass the jdbc properties into catalog?

  was:
In DriverManager, we can pass the info into a connection, which is more 
flexible.
{code:java}
@CallerSensitive
public static Connection getConnection(String url,
    java.util.Properties info) throws SQLException {

    return (getConnection(url, info, Reflection.getCallerClass()));
} {code}
 

For example, in [postgres 
document|https://jdbc.postgresql.org/documentation/use/]:

 
{code:java}
String url = "jdbc:postgresql://localhost/test";
Properties props = new Properties();
props.setProperty("user", "fred");
props.setProperty("password", "secret");
props.setProperty("ssl", "true");
Connection conn = DriverManager.getConnection(url, props); {code}
 

 

 

Currently ,in jdbc catalog, only username and password is passed( other jdbc 
properties is not provided.
{code:java}
@Override
public CatalogBaseTable getTable(ObjectPath tablePath)
        throws TableNotExistException, CatalogException {

    if (!tableExists(tablePath)) {
        throw new TableNotExistException(getName(), tablePath);
    }

    String databaseName = tablePath.getDatabaseName();
    String dbUrl = baseUrl + databaseName;

    try (Connection conn = DriverManager.getConnection(dbUrl, username, pwd)) {
////
} {code}
Why not pass the jdbc properties into catalog?


> Jdbc Catalog supports jdbc properties.
> --------------------------------------
>
>                 Key: FLINK-38616
>                 URL: https://issues.apache.org/jira/browse/FLINK-38616
>             Project: Flink
>          Issue Type: Improvement
>          Components: Connectors / JDBC
>    Affects Versions: jdbc-4.0.0
>            Reporter: Hongshun Wang
>            Priority: Major
>             Fix For: jdbc-4.1.0
>
>
> In DriverManager, we can pass the jdbc properties into a connection, which is 
> more flexible.
> {code:java}
> @CallerSensitive
> public static Connection getConnection(String url,
>     java.util.Properties info) throws SQLException {
>     return (getConnection(url, info, Reflection.getCallerClass()));
> } {code}
>  
> For example, in [postgres 
> document|https://jdbc.postgresql.org/documentation/use/]:
>  
> {code:java}
> String url = "jdbc:postgresql://localhost/test";
> Properties props = new Properties();
> props.setProperty("user", "fred");
> props.setProperty("password", "secret");
> props.setProperty("ssl", "true");
> Connection conn = DriverManager.getConnection(url, props); {code}
>  
>  
>  
> Currently ,in jdbc catalog, only username and password is passed( other jdbc 
> properties is not provided.
> {code:java}
> @Override
> public CatalogBaseTable getTable(ObjectPath tablePath)
>         throws TableNotExistException, CatalogException {
>     if (!tableExists(tablePath)) {
>         throw new TableNotExistException(getName(), tablePath);
>     }
>     String databaseName = tablePath.getDatabaseName();
>     String dbUrl = baseUrl + databaseName;
>     try (Connection conn = DriverManager.getConnection(dbUrl, username, pwd)) 
> {
> ////
> } {code}
> Why not pass the jdbc properties into catalog?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to