elixir-ecto / db_connection

Database connection behaviour
http://hexdocs.pm/db_connection/DBConnection.html
306 stars 113 forks source link

Incorrect syntax near '-' #114

Closed gac closed 6 years ago

gac commented 6 years ago

Hi, i have the next issue with a database name with "-"

config :my_app, MyApp.Repo, adapter: Tds.Ecto, username: "sa", password: "password", database: "db-name", hostname: "local.db.sqlserver", pool_size: 10

The dependencies are:

Resolving Hex dependencies... Dependency resolution completed: connection 1.0.4 db_connection 1.1.3 ecto 2.2.8 postgrex 0.13.3 tds 1.0.11 tds_ecto 2.0.7

And the error is:

[error] Tds.Protocol (#PID<0.4038.0>) failed to connect: ** (Tds.Error) Line 10 (Error 102): Incorrect syntax near '-'.

The database is en SQL Server 2008 R2

Elixir 1.4.5 Erlang/OTP 18 [erts-7.3.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V7.3.1

Thanks for your time !

josevalim commented 6 years ago

Please file this in your adapter, which seems to be TDS.Ecto. It seems quoting around the database name is required. Thanks!