PyCharm DB Navigator: how to fix "No such file or directory" - intellij-idea

I'm running PyCharm Community 2018.3 with the DB Navigator plugin. I've set up a connection and tested it. When I execute the SQL script
SELECT *
FROM table;
The DB execution console replies:
Creating temporary script file /tmp/DBN-4213556526222248783.sql
Executing command: /usr/bin/psql --echo-all --host=hostname.amazonaws.com --port=5432 --dbname=foo --username=bar -f "/tmp/DBN-4213556526222248783.sql"
Mar 9, 2019 11:24:44 AM: CIQ / CIQ - Script execution started
"/tmp/DBN-4213556526222248783.sql": No such file or directory
The /tmp/DBN- file exists and is world readable. /usr/bin/psql exists. I can cut and paste the same 'Executing Command' line into a shell and get a response from the database using it.

The issue is tracked under ticket https://database-navigator.atlassian.net/browse/DBN-298

Related

Unable to run .sql file in SQL Server

I have a .sql dump file 20 gb and I am trying to run it on Mysql workbench using run script and after successful execution, using SSMA I'll migrate the data from Mysql workbench to SQL Server. I have migrated the data this way many times successfully however for 20 gb file it seems very time-consuming. Please let me know if there is any alternate way to achieve this quickly. I have followed the following link:
Steps to migrate mysql tables to sql server using SSMA!
From your Title "unable to run .sql file in SSMS" and "I have a .sql dump file 20 gb" are you trying to open a 20GB .sql in SSMS? That's never going to work. SSMS is a 32bit application, so the maximum addressable memory is 2GB. If you want to run your .sql file, I suggest using sqlcmd.
Open up Powershell, and then run the command below replacing the appropriate parts:
sqlcmd -S {Server Name/ServerIP} -U {Your Login} -i {Your full path to your script}
You'll be prompted for your password and then you the file will be run. So, as an example, you might run:
sqlcmd -S svSQL2017 -U Larnu -i \\svFileServer\SQLShare\Scripts\BigBatchFile.sql
If you are using integrated security, then don't pass the -U parameter for the command.
Edit: This answer is no relevant to the OPs question, as they were using "SSMS" as a synonym for SQL Server, which it is not. I have left this here for the moment so the OP can review my comments, and I will likely remove this answer at a later point.

Bat file to run a sql query on a schedule through Task Scheduler

I am trying to run a .sql script on a schedule. I have created a batch file to run the script. The script runs fine in sql server management studio and also when I run the batch file content through cmd.
Contents of the batch file:
sqlcmd -S omfmesql -U OMESRV -P orat -i "\\pvsrv-
fsr14\data\Projects\Stat_Table_Creation_unique.sql"
The sql script is supposed to update a stat table. When I run it though cmd and refresh the stat table, the numbers are updated. But when I run this batch file through Task Scheduler, the only action that seems to be performed is running C:\Windows\SYSTEM32\cmd.exe
The task is stated to be completed successfully but the sql query is just not run.
I am not too experienced with Task Scheduler. Any help here would be very much appreciated. Thanks!
Note: I am not intending to use SQL Server Agent
If you have not done so, you need to set the location in Task Scheduler (TS). In at least some versions of TS, this can only be done when you create a basic task, not from the more general "Create Task..." option. Ensure that all the paths in the batch file are absolute or are based in this location.

SQL Schema Compare from one SQL version to another not working

In Visual Studio (2013 or 2015, they both do the same) > SQL Schema Compare, I am trying to copy the schema from one database on sql 2008, to databases on sql 2014. From 2008 -> 2008 works fine, 2014->2014 works fine, but when trying to go from 2008->2014, it does not work. After running the compare and hitting update it just sits on "Schema Compare generate script (db1 > db2) until it eventually freezes and visual studio just says it is busy, and never finishes. I can not find a log that explains what point it gets stuck on either.
Under options I have tried to ignore compatibility issues but this does not fix it. Any suggestions?
That might be a schema compare bug. I'd suggest first ensuring that you're using the latest version of the SQL Server tools (available for download here: https://msdn.microsoft.com/en-us/library/mt204009.aspx)
Then, if the problem still persists, I'd suggest capturing a trace log using the below instructions and opening a Connect issue that describes the problem and includes the trace log at https://connect.microsoft.com/SQLServer/feedback/CreateFeedback.aspx using the category "Developer Tools (SSDT, BIDS, etc.)"
Gathering an Event Log for SSDT
Open a new command prompt as Administrator.
Run this command logman create trace -n DacFxDebug -p "Microsoft-SQLServerDataTools" 0x800 -o "%LOCALAPPDATA%\DacFxDebug.etl" -ets
Then run this command: logman create trace -n SSDTDebug -p "Microsoft-SQLServerDataToolsVS" 0x800 -o "%LOCALAPPDATA%\SSDTDebug.etl" -ets
Run SSDT and reproduce the issue.
Go back to the command prompt and run the following commands:
logman stop DacFxDebug -ets
logman stop SSDTDebug -ets
The resulting ETL files will be located at %LOCALAPPDATA%\SSDTDebug.etl & %LOCALAPPDATA%\DacFxDebug.etl.
Instead of hitting "Update" try "Generate Script", and then run the script on the destination database.

run Pentaho transformation from Pan fails

I get an "not recognised as an internal or external command " error message when I run the following command:
C:\pdi-ce>Pan.bat /file=c:\pdi_labs\matches.ktr usa_201210.txt
pentaho 4.4.0 community edition is installed in :
C:\pdi-ce
transformation and files are saved in :
C:\pdi_labs\
Any hint to run the transformation from Pan since I am able to run it from Spoon.
regards
Generally Pentaho kettle creates another wrapper folder "data-integration" in installation directory. Check whether Pan.bat exists in the directory. If not cd to the directory which has it.
Pan.bat -file="c:\pdi_labs\matches.ktr" > usa_201210.txt
Assuming usa_201210.txt is the log file.
I would recommend starting pan.bat in a different shell and make it wait until it completes as below.
start /wait cmd "c:\pdi-ce\Pan.bat -file=c:\pdi_labs\matches.ktr > usa_201210.txt"
cd /C:/pdi-ce/
Pan.bat /file:"c:\pdi_labs\matches.ktr" /usa_201210.txt

failed to load resource file sqlcmd.rll

I have a sql script file which is 1.5GB
i want to run it but i cant use it using SQL Management Console, cause it can't load the file. I came up to the solution that run the query with SQLCMD utility but when i want to execute the file it returns (Failed to load resource file SQMCMD.rll)
sqlcmd -s (local) -i C:\myScript.sql
anyone knows what is the problem and how i can run this large script file ?
I had the same problem, and I have solved.
In my case the problem was I had installed more than one version of SQL (2005, 2008, 2012), and I had uninstalled the two first ones, so at this moment I only have the Sql Sever Express 2012.
After playing a lot of minutes I discovered that old installations left his respective sqlcmd.exe files in my machine, but the uninstall process removed the corresponding rll file.
When I hit in the cmd window the sqlcmd it seems the system tries to run the sqlcmd for one of the old sql installation.
Then I went to the folder of the installed version and that works.
It is (in my case, in your case you can find the file sqlcmd.exe):
1- cd C:\Program Files\Microsoft SQL Server\100\Tools\Binn
Inside that folder, then
2- SQLCMD -d databaseName -i C:\MyScripts\specificScript.sql
And that did the trick!
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=228de03f-3b5a-428a-923f-58a033d316e1&displaylang=en
I'd download the sqlcmd installer and run it - see if that fixes you up.
It's under "Microsoft SQL Server 2008 Command Line Utilities".
The installer should create that file and you'll be set. You could also try to run osql, which is the older command line SQL utility.
Edit:
Try this:
Please check the permission on the sqlcmd.exe and sqlcmd.rll and make sure the user has the read&execute permission on them. You also could specify the full path of the sqlcmd.exe in the command, such as:
"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -L
I just had this problem on SQL Server 2008 R2. Reinstalling the Command Line Utilities from the Feature Pack is what did it. The trick is if you are on 32-bit only install the x86 package, but if you are on 64-bit install both the x86 and the x64 package. The reason for this being is that some SQL Server tools are only 32-bit which means that both C:\Program Files\Microsoft SQL Server\100\Tools\Binn and C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn are in your PATH variable in order to ensure all of the tools are accessible, which means either of them could be run, therefore both of them need to reinstalled to ensure you have them run properly.
In my case the issue arised after migrating from SQL Server 2008 R2 to SQL Server 2012.
The problem was pretty simple. It was the path. Just correct your SQL Server path in the System path pointing to the new directory.
I got a variant of this error in an Linux installation of the MS SQL Server CLI for Linux, which stated,
# bcp
Unable to load BCP resource DLL. BCP cannot continue.
# sqlcmd
Unable to load SQLCMD resource file(s)
I found that I had not followed the installation direction exactly, in that rather than modify the system PATH to add the installation directory (/opt/mssql-tools/bin), I had used 'install' to copy the binaries to /usr/local/bin without the corresponding /opt/mssql-tools/share directory.
for I in /opt/mssql-tools/bin/*; do install $I /usr/local/bin; done
When I removed those copies and did export PATH="$PATH:/opt/mssql-tools/bin" as the instructions show, then it worked.
# bcp
usage: bcp {dbtable | query} {in | out | queryout | format} datafile
[...]
# sqlcmd
Microsoft (R) SQL Server Command Line Tool
Version 17.1.0000.1 Linux
[...]