nifi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anil Rai <anilrain...@gmail.com>
Subject Re: Connection Issue
Date Wed, 15 Mar 2017 12:58:00 GMT
Hi Oleg, Thanks. attached is the log. Let me know if you want us to change
the log levels and re-run and send you additional logs?


On Tue, Mar 14, 2017 at 5:12 PM, Oleg Zhurakousky <
ozhurakousky@hortonworks.com> wrote:

> Anil
>
> I understand that you are having an issue and we are here to help, but we
> can only do this if you help us just a little more, so it would be very
> helpful if you provided a stack trace (I understand if you have to mask
> sensitive information).
> The “. . .fails saying cannot create AQSession. . .” could be due to
> various reasons and until we see the stack trace everything here would be
> speculation.
> I hope you understand
>
> Cheers
> Oleg
>
> > On Mar 14, 2017, at 4:59 PM, Anil Rai <anilrainifi@gmail.com> wrote:
> >
> > Here is the behaviour that we have seen so for....hope this helps
> >
> >   1. When we run the java code in eclipse, it works and this is the
> >   connection object that is printed ->
> >   oracle.jdbc.driver.T4CConnection@6f75e721
> >   2. When we hard code all the values as mentioned in my first email in a
> >   custom processor, deploy that. It works as well. The above connection
> >   object gets printed.
> >   3. When we change the code in the custom processor to use the DBCP
> >   connection service, deploy that. The connection object that gets
> printed is
> >   jdbc:oracle:thin:@oged-scan.og.ge.com:1521/ORPOGPB1 and this does not
> >   work. aqSession = AQDriverManager.createAQSession(connection) fails
> >   saying cannot create AQSession.
> >
> > Thanks
> > Anil
> >
> >
> > On Tue, Mar 14, 2017 at 4:13 PM, Oleg Zhurakousky <
> > ozhurakousky@hortonworks.com> wrote:
> >
> >> Anil
> >>
> >> When you say "it does not like the connection object. . .” what do you
> >> mean by that?
> >> Can you please provide stack trace or some other details?
> >>
> >> Cheers
> >> Oleg
> >>
> >>> On Mar 14, 2017, at 4:06 PM, Anil Rai <anilrainifi@gmail.com> wrote:
> >>>
> >>> Thanks Russ. Yes, we are doing exactly the same thing.
> >>>
> >>>       driverClass = context.getProperty(DRIVER_CLASS).getValue();
> >>>       queueName = context.getProperty(QUEUE_NAME).getValue();
> >>>       databaseSchema = context.getProperty(DATABASE_
> SCHEMA).getValue();
> >>>       consumerName = context.getProperty(CONSUMER_NAME).getValue();
> >>>       eventName = context.getProperty(EVENT_NAME).getValue();
> >>>       DBCPService connection =
> >>> context.getProperty(JDBC_CONNECTION_POOL).asControllerService(
> >> DBCPService.class);
> >>>       Connection conn = connection.getConnection();
> >>> *        aqSession = AQDriverManager.createAQSession(connection);*
> >>>
> >>> The underlined code above fails as it does not like the connection
> object
> >>> that is returned by the DBCPService.
> >>>
> >>> Regards
> >>> Anil
> >>>
> >>>
> >>> On Tue, Mar 14, 2017 at 2:43 PM, Russell Bateman <
> russ@windofkeltia.com>
> >>> wrote:
> >>>
> >>>> Anil,
> >>>>
> >>>> Typically, your custom processor should have a property, something
> like
> >>>>
> >>>>   public static final PropertyDescriptor DBCP_SERVICE = new
> >>>> PropertyDescriptor.Builder()
> >>>>           .name("Database Connection Pooling Service")
> >>>>           .description("The Controller Service that is used to obtain
> >>>> connection to database")
> >>>>           .required(true)
> >>>>           .identifiesControllerService(DBCPService.class)
> >>>>           .build();
> >>>>
> >>>> When your NiFi user sets up the flow, he or she puts a reference to
> >> NiFi's
> >>>> DBCPConnectionPool in it. In configuring that (a ControllerService,
> you
> >>>> tell it that it's Oracle, location, etc.)
> >>>>
> >>>> Then, your onTrigger() code would do something like this:
> >>>>
> >>>>       final DBCPService dbcpService = context.getProperty(DBCP_SERVI
> >>>> CE).asControllerService(DBCPService.class);
> >>>>
> >>>>
> >>>> and later...
> >>>>
> >>>>
> >>>>       try (final Connection connection = dbcpService.getConnection())
> >>>>       {
> >>>>           try (final Statement stmt = connection.createStatement(
> >> ResultSet.TYPE_FORWARD_ONLY,
> >>>> ResultSet.CONCUR_READ_ONLY))
> >>>>
> >>>> etc.
> >>>>
> >>>> Does this help?
> >>>>
> >>>> Russ
> >>>>
> >>>>
> >>>>
> >>>> On 03/14/2017 11:54 AM, Anil Rai wrote:
> >>>>
> >>>>> We have a use case to connect to oracle database and subscribe to
> >> Advanced
> >>>>> Queuing (https://docs.oracle.com/cd/A58617_01/server.804/a58241/
> >> ch_aq.htm
> >>>>> ).
> >>>>> Below is the java snippet to establish this connection from a java
> >> client.
> >>>>> We can run this in eclipse and consume message from the advanced
> queue.
> >>>>> **************
> >>>>>            Class.forName("oracle.jdbc.driver.OracleDriver");
> >>>>>            connection = DriverManager.getConnection("
> >>>>> jdbc:oracle:thin:@xxx-yyy.zzz.com:1521/DB1","user", "pwd");
> >>>>>            connection.setAutoCommit(true);
> >>>>>            Class.forName("oracle.AQ.AQOracleDriver");
> >>>>>            aqSession = AQDriverManager.createAQSession(connection);
> >>>>>            System.out.println("AQ Session --->" + aqSession);
> >>>>> ********************
> >>>>>
> >>>>> We have created a custom processor in Nifi. This processor is getting
> >> the
> >>>>> connection string using getConnection function of Standard DBCP
> >> service.
> >>>>> The problem is, the connection object that is retrieved from eclipse
> >>>>> versus
> >>>>> what is returned from DBCP service is different. We have made sure
we
> >> are
> >>>>> referring to the same jar both in eclipse and Nifi (ojdbc7.jar)
> >>>>> It fails @  aqSession = AQDriverManager.createAQSession(connection);
> >>>>> The connection object that comes from DBCP is not what is expected
by
> >>>>> AQDriverManager.
> >>>>>
> >>>>> Any help is greatly appreciated.
> >>>>>
> >>>>> Thanks
> >>>>> Anil
> >>>>>
> >>>>>
> >>>>
> >>
> >>
>
>

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message