Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure MS SQL Server - USE statement is not supported to switch between databases #133

Open
AllezWiggo opened this issue May 12, 2023 · 1 comment

Comments

@AllezWiggo
Copy link

AllezWiggo commented May 12, 2023

Hi,
I'm trying to use fluent-plugin-sql with Azure MS SQL Server DB and getting error.

Dockerfile partial config:

  && gem install fluent-plugin-sql --no-document \
  && gem install tiny_tds \
  && gem install activerecord-sqlserver-adapter \

fluent.conf

<match *>
  @type sql
  host ...
  port 1433
  database ...
  adapter sqlserver
  username ...
  password ...
  <table>
    table ...
  </table>
</match>

Error in fluentd logs:

  2023-05-12 19:59:57 +0000 [warn]: #0 failed to flush the buffer. retry_times=0 next_retry_time=2023-05-12 19:59:58 +0000 chunk="5fb8489140af6d7034566d69be465982" error_class=TinyTds::Error error="USE statement is not supported to switch between databases. Use a new connection to connect to a different database."
  2023-05-12 19:59:57 +0000 [warn]: #0 /usr/local/rvm/rubies/ruby-3.1.4/lib/ruby/gems/3.1.0/gems/tiny_tds-2.1.5/lib/tiny_tds/client.rb:60:in `connect'
  2023-05-12 19:59:57 +0000 [warn]: #0 /usr/local/rvm/rubies/ruby-3.1.4/lib/ruby/gems/3.1.0/gems/tiny_tds-2.1.5/lib/tiny_tds/client.rb:60:in `initialize'
  2023-05-12 19:59:57 +0000 [warn]: #0 /usr/local/rvm/rubies/ruby-3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-sqlserver-adapter-7.0.2.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:90:in `new'
  2023-05-12 19:59:57 +0000 [warn]: #0 /usr/local/rvm/rubies/ruby-3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-sqlserver-adapter-7.0.2.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:90:in `dblib_connect'
  2023-05-12 19:59:57 +0000 [warn]: #0 /usr/local/rvm/rubies/ruby-3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-sqlserver-adapter-7.0.2.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:83:in `new_client'
  2023-05-12 19:59:57 +0000 [warn]: #0 /usr/local/rvm/rubies/ruby-3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-sqlserver-adapter-7.0.2.0/lib/active_record/sqlserver_base.rb:15:in `sqlserver_connection'

Looks like Azure SQL Server doesn't support USE command to switch database. Anyone faced and resolved this?
Thanks in advance.

@jpnwagwu
Copy link

Faced similar issue but not resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants