Logstash unable to query Database

I'm using jbdc filter in logstash to pull the records. I'm getting the below error in the logstash logs.

[2019-11-20T12:22:01,666][WARN ][logstash.inputs.jdbc ] Exception when executing JDBC query {:exception=>#<Sequel::DatabaseError: Java::JavaSql::SQLException: Stream has already been closed>}

Below is my input config:
jdbc {

    jdbc_connection_string => "jdbc:oracle:thin:@//XXXX:1531/XXXX"
    jdbc_user => "XXXXXX"
    jdbc_password => "XXXXX"
    jdbc_validate_connection => true
    jdbc_driver_library => "/etc/logstash/conf.d/ojdbc7-12.1.0.2.jar"
    jdbc_driver_class =>"Java::oracle.jdbc.driver.OracleDriver"
    schedule => "* * * * *"
    statement => "select * from table WHERE INITIATION_TIME > :sql_last_value ORDER by INITIATION_TIME"
    use_column_value => true
    tracking_column => "initiation_time"
    tracking_column_type => "timestamp"
    last_run_metadata_path => "/etc/logstash/conf.d/.logstash_jdbc_last_run"
  }

The same input config for Dev DB connection is working. But when I change the DB details to Testing environment, I'm getting the above error.

P.S: A single error is printed. There is no log stacktrace.