Running DOS COMMAND on SQlcmd does not work - sqlcmd

Hi I am trying execute the DOS COMMAND on sqlcmd on a DOS TERMINAL but it simply does not return anything even error.
When I execute it on SSMS it works.
Do you know that is going on?

I have found out the problem.
The problem is: I have to version on my machine 32 bit and 64 bit, by default when I open the DOS PROMPT and run the sqlcmd it assumes the 32 bit version. As my OS is 64 bit the 32 bit does not work.
So I just renamed the sqlcmd 32 bit on the folder the it is in. Now when I open the prompt and run the sqlcmd the 64 bit comes to play and every command started with :!! works.

Related

Excel VBA Connection string to MySQL remote Database is not working

I have MySQL server installed on a remote machine.
I am trying to connect to it via excel VBA - i can succesfully connect to it through excels built-in database connection tools and copy the connection string, however, VBA hates that connection string. here is my code and the error
Dim conn As New ADODB.Connection
Dim sConnectionString As String
Set conn = New ADODB.Connection
sConnectionString = "ODBC;Driver={MySQL ODBC 5.3 ANSI Driver};Provider=MSDASQL;Server=AddressHere;Port=3306;Database=DatabaseName;User=UserName;Option=3"
conn.ConnectionString = sConnectionString
conn.Open
Here is the error messgae i get when it tries to connect, i have verified that the ODBC driver is installed.
Have you checked to make sure 32 bit vs 64 bit are all configured/installed? It gets a bit messy...
Based on personal experience with a very similar problem. 64 bit OS using 32 bit office install and 32 bit mySQL eventually made it work for me.. but different combinations can prove to be incompatible.
Don't think that your 64 bit OS means you need 64 bit mySQL if your Office install is 32 bit. Also keep in mind that if you use ODBC to connect, there are 32 bit and 64 bit versions of that too in your system.

MySQL command line client crashes

While I try to source a .sql file of size 6GB, MySQL command line client crashes abruptly without even throwing any error.
I tried to set max_allowed_packet to a limit of 16M and tried SET ##local.net_read_timeout=360;.
The SQL file does not have any command that is likely to close the connection. Only table creation and value insertion commands are there. Since the crash is abrupt, can't figure out the root cause.
Can anyone help me in analyzing this further?
Assuming it's a Linux box, try running the command with strace
strace -ff -o mysql.strace <your mysql cmd>
Log at mysql.strace.[PID] can show how far the execution went.

Delphi + MySQL command line

I'm building a tool using Delphi and MySQL to restore a script generated with MySQLDump.
It was supposed to load and execute a SQL file and log any possible errors into a given output file.
I thought about execute the mysql command line and send command lines but i don't know if its possible ou how to do it since I just know how to call mysql using windows cmd and execute a single command line using ShellExecute or CreateProcess
I tried to do it with a single command line but it did'nt logged the errors properly
I tried this:
cmd /c mysql.exe --user root < "C:\restore.sql" > "C:\restore_log.txt"
the content of restore.sql was:
drop database test;
It does execute my script, but on the second attempt it should log "database doesn't exist" but restore_log.txt was empty
It would help if anyone could point the way to call mysql and send multiple lines OR a help with my cmd line to log properly
Anyone can help me?
I don't know what components you've got available to connect to the MySQL db, but using TADOQuery to access SQL Server, I simply load up the queries into a TADOQuery's .SQL property and then call Open or ExecSQL. As long as it's just vanilla SQL that was generated by SQLDump, I'd guess that should work. It's worth a try anyway.
digging more at stackoverflow I found previous answers that helped, the difference is that the output goes to a Memo that I can save to a file.
Thank you all for the help and the insights.
The answers can be found on the following links:
Getting output from a shell/dos app into a Delphi app
How do I run a command-line program in Delphi?
Getting output from a shell/dos app into a Delphi app

64 bit Wscript AND 64 bit Microsoft.ACE.OLEDB.12.0

I have 64 bit windows 10 (and 7), 64 bit wscript opening my script, and AccessDatabaseEngine_x64.
I cannot get things to work with everything running x64, though 32 bit wscript works fine. I have attempted this on several computers including a new windows install. I am always greeted with...
Script: C:\Users\ARoberts\Desktop\REPORTER\reporter_1.vbs
Line: 126
Char: 3
Error: Provider cannot be found. It may not be properly
installed.
Code: 800A0E7A
Source: ADODB.Connection
from the below VBSCRIPT connection method.
Set DBConn = CreateObject("ADODB.Connection")
With DBConn
.Provider = "Microsoft.ACE.OLEDB.12.0"
'.Properties("Extended Properties").Value = "Excel 12.0 Xml; ReadOnly=false; HDR=Yes;IMEX=1;"
.Open fso.BuildPath(CurrentDirectory, "DB.mdb")'xlsx")
End With
I have done countless hours of research on this and wonder if the driver simply isn't capable of playing nicely with x64-wscript. I have tried excel files, access databases, along with a preconfigured User DSN. My database is very large and requires a large amount of processing.
Please let me know what other information I can provide and I will update my question with it.

Open a Sequel Pro connection from command line

I have a database on a SaaS platform (Pantheon), and the connection string changes frequently (multiple times per day). This makes Sequel Pro favorites pretty useless.
I can easily fetch the new connection string from Terminal, and I can launch Sequel Pro from Terminal, but I can't figure out how to feed the connection string to Sequel Pro properly.
I've read through this thread, but just cannot figure out the proper syntax.
How can I make it work? Any other ideas about how to achieve similar?
Maybe you could write the changes to your Sequel Pro Favourites.plist -file and then start the program with --favorite (--favorite=site1 etc.) parameter.
Favourites.plist is normal text file in xml form and can be edited with a script etc.
In Mac OS X the favourites file is at ~/Library/Application Support/Sequel Pro/Data/Favourites.plist
This won't work if your password changes also as it's stored OS X Keychain. (Not sure where passwords are in Windows, sorry)