You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Peter Wicks (JIRA)" <ji...@apache.org> on 2016/09/13 03:50:20 UTC

[jira] [Comment Edited] (NIFI-2764) JdbcCommon Avro Can't Process Java Short Types

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

Peter Wicks edited comment on NIFI-2764 at 9/13/16 3:49 AM:
------------------------------------------------------------

The Unit Test I wrote, that I can't bring myself to check-in:

`@Test
    @Ignore("Intended only for local testing, not automated testing")
    public void testMSSQLIntColumns() throws SQLException, InitializationException {
        QueryDatabaseTable qdbProcessor = new MockQueryDatabaseTable();
        TestRunner qdbRunner = TestRunners.newTestRunner(qdbProcessor);

        final DBCPConnectionPool service = new DBCPConnectionPool();
        runner.addControllerService("dbcp", service);

        // set embedded Derby database connection url
        runner.setProperty(service, DBCPConnectionPool.DATABASE_URL, "jdbc:sqlserver://localhost;DatabaseName=nifiTest;portNumber=1433;instanceName=./SQLEXPRESS");
        runner.setProperty(service, DBCPConnectionPool.DB_USER, "nifi");
        runner.setProperty(service, DBCPConnectionPool.DB_PASSWORD, "nifi");
        runner.setProperty(service, DBCPConnectionPool.DB_DRIVERNAME, "com.microsoft.sqlserver.jdbc.SQLServerDriver");
        runner.setProperty(service, DBCPConnectionPool.DB_DRIVER_LOCATION, "C:/Users/pwicks/Downloads/sqljdbc_6.0/enu/sqljdbc41.jar");

        runner.enableControllerService(service);

        runner.setIncomingConnection(false);
        runner.setProperty(QueryDatabaseTable.TABLE_NAME, "testtable");
        runner.run();

        runner.assertAllFlowFilesTransferred(QueryDatabaseTable.REL_SUCCESS, 1);
        runner.getFlowFilesForRelationship(QueryDatabaseTable.REL_SUCCESS).get(0).assertAttributeEquals(QueryDatabaseTable.RESULT_ROW_COUNT, "3");
    }`


was (Author: patricker):
The Unit Test I wrote, that I can't bring myself to check-in:

@Test
    @Ignore("Intended only for local testing, not automated testing")
    public void testMSSQLIntColumns() throws SQLException, InitializationException {
        QueryDatabaseTable qdbProcessor = new MockQueryDatabaseTable();
        TestRunner qdbRunner = TestRunners.newTestRunner(qdbProcessor);

        final DBCPConnectionPool service = new DBCPConnectionPool();
        runner.addControllerService("dbcp", service);

        // set embedded Derby database connection url
        runner.setProperty(service, DBCPConnectionPool.DATABASE_URL, "jdbc:sqlserver://localhost;DatabaseName=nifiTest;portNumber=1433;instanceName=./SQLEXPRESS");
        runner.setProperty(service, DBCPConnectionPool.DB_USER, "nifi");
        runner.setProperty(service, DBCPConnectionPool.DB_PASSWORD, "nifi");
        runner.setProperty(service, DBCPConnectionPool.DB_DRIVERNAME, "com.microsoft.sqlserver.jdbc.SQLServerDriver");
        runner.setProperty(service, DBCPConnectionPool.DB_DRIVER_LOCATION, "C:/Users/pwicks/Downloads/sqljdbc_6.0/enu/sqljdbc41.jar");

        runner.enableControllerService(service);

        runner.setIncomingConnection(false);
        runner.setProperty(QueryDatabaseTable.TABLE_NAME, "testtable");
        runner.run();

        runner.assertAllFlowFilesTransferred(QueryDatabaseTable.REL_SUCCESS, 1);
        runner.getFlowFilesForRelationship(QueryDatabaseTable.REL_SUCCESS).get(0).assertAttributeEquals(QueryDatabaseTable.RESULT_ROW_COUNT, "3");
    }

> JdbcCommon Avro Can't Process Java Short Types
> ----------------------------------------------
>
>                 Key: NIFI-2764
>                 URL: https://issues.apache.org/jira/browse/NIFI-2764
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.0.0
>            Reporter: Peter Wicks
>
> Microsoft SQL Server returns TINYINT values as Java Short's.  Avro is unable to write datum's of this type and throws an exception when trying to.
> This currently breaks QueryDatabaseTable at the very least when querying MS SQL Server with TINYINT's in the ResultSet.



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