TinyTds::Error: Server name not found in configuration files
TinyTds::Error: Server name not found in configuration files
我正在 Docker + Rails + Windows 上使用 Tiny TDS。
在我开始对环境进行 docker 化之前,此配置一直有效。
任何帮助深表感谢。
宝石文件
gem 'tiny_tds'
gem 'rails', '4.2.8'
Docker文件
FROM ruby:2.4.0
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
RUN apt-get update && apt-get install -y dos2unix
RUN apt-get update && apt-get install -yq freetds-bin
RUN mkdir /myapp
WORKDIR /myapp
ADD Gemfile /myapp/Gemfile
ADD Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
COPY . /myapp
# Add a script to be executed every time the container starts.
COPY entrypoint.sh /usr/bin/
# Start the main process.
RUN dos2unix entrypoint.sh && apt-get --purge remove -y dos2unix && rm -rf /var/lib/apt/lists/*
EXPOSE 3000
Docker-compose.yml
version: '3'
services:
db:
image: postgres:12-alpine
redis:
image: redis:alpine
server:
tty: true
stdin_open: true
build: .
command: bash -c "rm -f tmp/pids/server.pid && rake db:create && rake db:migrate && bundle exec rails s -p 3000 -b '0.0.0.0'"
links:
- db
- redis
volumes:
# - ./tmp/db:/var/lib/postgresql/data
- .:/usr/src/app
# - .:/myapp
ports:
- "3000:3000"
- "1433:1433"
- "1434:1434"
environment:
DATABASE_URL: postgres://postgres@db:5432/app?pool=25&encoding=unicode&schema_search_path=public
# DEVISE_JWT_SECRET_KEY: RANDOM_SECRET
REDIS_URL: redis://redis:6379
当我测试连接时
client = TinyTds::Client.new username: 'sa',
password: 'password',
port: 1433,
host: 'server_name', # works if you are not using docker
# dataserver: 'server_name', #This did not work as well
timeout: 10000
错误信息:
TinyTds::Error: Server name not found in configuration files from
/usr/local/bundle/gems/tiny_tds-1.0.4/lib/tiny_tds/client.rb:43:in
`connect'
非常感谢任何帮助。
根据@lyzard-kyng 对问题的评论,IP 地址有助于诊断问题。
DNS 后缀属性由 windows 管理。我不得不将它们添加到 server_name.
我正在 Docker + Rails + Windows 上使用 Tiny TDS。 在我开始对环境进行 docker 化之前,此配置一直有效。 任何帮助深表感谢。
宝石文件
gem 'tiny_tds'
gem 'rails', '4.2.8'
Docker文件
FROM ruby:2.4.0
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
RUN apt-get update && apt-get install -y dos2unix
RUN apt-get update && apt-get install -yq freetds-bin
RUN mkdir /myapp
WORKDIR /myapp
ADD Gemfile /myapp/Gemfile
ADD Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
COPY . /myapp
# Add a script to be executed every time the container starts.
COPY entrypoint.sh /usr/bin/
# Start the main process.
RUN dos2unix entrypoint.sh && apt-get --purge remove -y dos2unix && rm -rf /var/lib/apt/lists/*
EXPOSE 3000
Docker-compose.yml
version: '3'
services:
db:
image: postgres:12-alpine
redis:
image: redis:alpine
server:
tty: true
stdin_open: true
build: .
command: bash -c "rm -f tmp/pids/server.pid && rake db:create && rake db:migrate && bundle exec rails s -p 3000 -b '0.0.0.0'"
links:
- db
- redis
volumes:
# - ./tmp/db:/var/lib/postgresql/data
- .:/usr/src/app
# - .:/myapp
ports:
- "3000:3000"
- "1433:1433"
- "1434:1434"
environment:
DATABASE_URL: postgres://postgres@db:5432/app?pool=25&encoding=unicode&schema_search_path=public
# DEVISE_JWT_SECRET_KEY: RANDOM_SECRET
REDIS_URL: redis://redis:6379
当我测试连接时
client = TinyTds::Client.new username: 'sa',
password: 'password',
port: 1433,
host: 'server_name', # works if you are not using docker
# dataserver: 'server_name', #This did not work as well
timeout: 10000
错误信息:
TinyTds::Error: Server name not found in configuration files from /usr/local/bundle/gems/tiny_tds-1.0.4/lib/tiny_tds/client.rb:43:in `connect'
非常感谢任何帮助。
根据@lyzard-kyng 对问题的评论,IP 地址有助于诊断问题。 DNS 后缀属性由 windows 管理。我不得不将它们添加到 server_name.