[ 
https://issues.apache.org/jira/browse/TRAFODION-1986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15409526#comment-15409526
 ] 

ASF GitHub Bot commented on TRAFODION-1986:
-------------------------------------------

Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/631#discussion_r73702591
  
    --- Diff: 
core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Connection.java ---
    @@ -1918,8 +1918,52 @@ public Struct createStruct(String typeName, Object[] 
attributes)
        }
     
        public void setSchema(String schema) throws SQLException {
    -           // TODO Auto-generated method stub
    -           
    +            if (props_.t4Logger_.isLoggable(Level.FINE) == true) {
    +                Object p[] = T4LoggingUtilities.makeParams(props_, schema);
    +                props_.t4Logger_.logp(Level.FINE, "TrafT4Connection", 
"setSchema", "", p);
    +            }
    +            if (props_.getLogWriter() != null) {
    +                LogRecord lr = new LogRecord(Level.FINE, "");
    +                Object p[] = T4LoggingUtilities.makeParams(props_, schema);
    +                lr.setParameters(p);
    +                lr.setSourceClassName("TrafT4Connection");
    +                lr.setSourceMethodName("setSchema");
    +                T4LogFormatter lf = new T4LogFormatter();
    +                String temp = lf.format(lr);
    +                props_.getLogWriter().println(temp);
    +            }
    +            clearWarnings();
    +            if (_isClosed() == true) {
    +                throw TrafT4Messages.createSQLException(props_, null, 
"invalid_connection", null);
    +            }
    +            if (schema != null && !"".equals(schema)) {
    +                Statement stmt = null;
    +                try {
    +                    stmt = createStatement();
    +                    stmt.execute("set schema " + schema);
    +                } catch (TrafT4Exception se) {
    +                    performConnectionErrorChecks(se);
    +                    throw se;
    +                } finally {
    +                    if (stmt != null) {
    +                        try {
    +                            stmt.close();
    +                        } catch (Exception e) {
    --- End diff --
    
    Consider changing the  Exception to SQLException or TrafT4Exception


> trafodion jdbc t4 api can't set schema
> --------------------------------------
>
>                 Key: TRAFODION-1986
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-1986
>             Project: Apache Trafodion
>          Issue Type: Bug
>            Reporter: mashengchen
>            Assignee: mashengchen
>
> connection.setSchema(string schemaName) doesn't work.
> --------------------------------
> connection.setSchema("_REPOS_");
> System.out.println(connection.getSchema());
> ---------------------------------------------------
> the output is still "SEABASE"
> the source code seems doesn't implement



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to