7

I used maven,Microsoft SQL server management studio 17.SQL server verion is 14.0.1000.169. When i build my project it gives following error and build failed

'sqlpackage.exe' is not recognized as an internal or external command,
operable program or batch file.
[ERROR] The following errors occured during execution:
[ERROR] 'sqlpackage.exe' is not recognized as an internal or external command,
[ERROR] operable program or batch file.

This is my system environment path variables. enter image description here

I can't find what's the wrong

Jayani Sumudini
  • 1,409
  • 2
  • 22
  • 29
  • Please do not add the `sql` tag to your question: there is no SQL query involved in your question. And "SQL" is not the same as "Microsoft SQL Server". –  May 23 '18 at 05:52
  • 1
    I just got the same problem. Even though my path was in the env it was saying `is not recognized...` It is case sensitive once I put `SqlLocalDB.exe` all good. – virtualdvid Feb 05 '21 at 19:42

6 Answers6

8

I didn't have the location of sqlpackage.exe in the PATH variable. After adding it to PATH variable, had resolved the issue for me. (Something like below)

C:\Program Files\Microsoft SQL Server\140\DAC\bin
Jude Niroshan
  • 4,280
  • 8
  • 40
  • 62
  • For me I had just to change the version (SQL Server 2022 = 160) -> C:\Program Files\Microsoft SQL Server\160\DAC\bin – Adel Mourad May 05 '23 at 14:07
4

It's fixed using following steps.

this is because you haven't sqlpackage.exe in your Path variables. to fix this follow below steps.

You need to Install Sql server data tools

For windows,

  • Install chocolatey
  • Install SSDT components
  • Add sqlpackage.exe to classpath

For Install chocolatey

For Install SSDT components

  • choco install sqlserver-cmdlineutils

  • choco install sql2014.clrtypes

  • choco install sql2014-sqldom

  • choco install sql2014-dacframework

For Add sqlpackage.exe to classpath

  • RUN setx PATH "%PATH%;C:\Program Files\Microsoft SQL Server\120\DAC\bin;"
Jayani Sumudini
  • 1,409
  • 2
  • 22
  • 29
  • it is not recommended to use previous version of DacFx with current version of SQL Server. I believe, previous versions of DacFx do not implement all features available in SQL Server 14.0 (2017) – Dmitry Kolchev May 23 '18 at 06:10
1

Looks like you havn't installed Data-tier Application Framework. You can download and install DacFx (17.4.1) from https://www.microsoft.com/en-us/download/details.aspx?id=56508

Dmitry Kolchev
  • 2,116
  • 14
  • 16
1

Adding these locations into path variable will fix both maven and gradle error if you already installed mssql server 2019.

C:\Program Files (x86)\Microsoft SQL Server\140\DAC\bin

C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn

0

Download Microsoft SQL Server Data-Tier Application Framework from https://www.microsoft.com/en-us/download/details.aspx?id=56508 and open Environment settings and set the PATH variable to C:\Program Files\Microsoft SQL Server\140\DAC\bin

Chanaka Fernando
  • 2,176
  • 19
  • 19
0

try following:

  1. install https://dotnet.microsoft.com/download/dotnet/3.1
  2. install https://learn.microsoft.com/en-us/sql/tools/sqlpackage/sqlpackage-download?view=sql-server-ver15
  3. run this command in terminal in projects directory(without braces) "dotnet add package Microsoft.SqlServer.DACFx"
Oleksandr Hrin
  • 757
  • 1
  • 10
  • 12