Azure SQL Managed Instance error "Could not load the DLL odsole70.dll, or one of the DLLs it references" - azure-sql-database

I am trying to call the API service from Azure SQL Managed Instance database and I am getting the error below. However, when I execute from my local SQL server, it works fine.
I used the queries below:
USE MASTER
GO
sp_configure 'show advanced options', 1
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1
GO
RECONFIGURE;
GO
sp_configure 'show advanced options', 0
GO
RECONFIGURE;
Exec sp_OACreate 'MSXML2.XMLHTTP', #Object OUT;
Exec sp_OAMethod #Object, 'open', NULL, 'post',
'https://localhost:7071/api/HashPwd',
'false'
Exec sp_OAMethod #Object, 'send'
Exec sp_OAMethod #Object, 'responseText', #ResponseText OUTPUT
Select #ResponseText
Error ---
Msg 17750, Level 16, State 0, Procedure sp_OACreate, Line 1 [Batch Start Line 0]
Could not load the DLL odsole70.dll, or one of the DLLs it references. Reason: 2(The system cannot find the file specified.).
Msg 17750, Level 16, State 0, Procedure sp_OAMethod, Line 1 [Batch Start Line 0]
Could not load the DLL odsole70.dll, or one of the DLLs it references. Reason: 2(The system cannot find the file specified.).
Msg 17750, Level 16, State 0, Procedure sp_OAMethod, Line 1 [Batch Start Line 0]
Could not load the DLL odsole70.dll, or one of the DLLs it references. Reason: 2(The system cannot find the file specified.).
Msg 17750, Level 16, State 0, Procedure sp_OAMethod, Line 1 [Batch Start Line 0]
Could not load the DLL odsole70.dll, or one of the DLLs it references. Reason: 2(The system cannot find the file specified.).
How do I fix the error?

If you want to use OLE Automation Stored Procedures, we just can use it on-premise SQL server. We cannot use it in Azure SQL database or Azure SQL managed instance. For more details, please refer to the document and the document

Related

Polybase configuration for SQL Server 2016

According to Microsoft's documentation after installing PolyBase I should run the following code.
exec sp_configure #configname = 'polybase enabled', #configvalue = 1;
RECONFIGURE;
When I try to execute this command it displays an error. How can I add 'polybase enabled' to the configuration using sp_configure ?
Msg 15123, Level 16, State 1, Procedure sp_configure, Line 62 [Batch Start Line 0]
The configuration option 'polybase enabled' does not exist, or it may be an advanced option
What I've done so far :
PolyBase is installed.
I checked SELECT SERVERPROPERTY ('IsPolybaseInstalled') AS IsPolybaseInstalled; - it returns 1.
I enabled EXEC sp_configure 'hadoop connectivity', 7;
My TCP is enabled.
My PolyBase is running.
On the PolyBase tab, I see two "Scale-out Groups" : Head and Compute.
sys.configurations
polybase network encryption = 1
allow polybase export = 1
show advanced options = 1
The documentation is wrong, in 2016 all you need to enable is "hadoop connectivity" which you've already done. Now check the status of the Polybase services, and you should be good to go.

Getting 0x800C0005 System error in SQL Server

The following code is used to call a web service from SQL Server:
Declare #Object as Int;
Declare #ResponseText as VARCHAR(MAX);
Exec sp_OACreate 'MSXML2.XMLHTTP', #Object OUT;
Exec sp_OAMethod #Object, 'open', NULL, 'GET','http://localhost/Service1.asmx/HelloWorld?name=xyz', false;
Exec sp_OAMethod #Object, 'send';
EXEC sp_OAGetErrorInfo #Object
Create table #tmp(dt varchar(max))
insert into #tmp
exec sp_OAGetProperty #Object, 'ResponseText' --,#strLine OUtPUT
Select dt from #tmp -- single column/single row.
Drop Table #tmp -- clean up
Exec sp_OADestroy #Object;
But I am getting below error:
0x800C0005 msxml3.dll System error: -2146697211
Any pointers ...?
There are two (2) ways to fix Msxml3 Dll 0x800c0005 System Error Error:
Advanced Computer User Solution (manual update):
1) Start your computer and log on as an administrator.
2) Click the Start button then select All Programs, Accessories, System Tools, and then click System Restore.
3) In the new window, select "Restore my computer to an earlier time" option and then click Next.
4) Select the most recent system restore point from the "On this list, click a restore point" list, and then click Next.
5) Click Next on the confirmation window.
6) Restarts the computer when the restoration is finished.
Novice Computer User Solution (completely automated):
1) Download (Msxml3 Dll 0x800c0005 System Error) repair utility.
2) Install program and click Scan button.
3) Click the Fix Errors button when scan is completed.
4) Restart your computer.
More details

Unable to delete zip files from DB server location using xp_cmdshell

I have a Zip file created and I am unable to delete it using the below command.
xp_cmdshell 'rm "F:\EXIS\Reports\Individual.zip"'
It gives an error saying File not found, when I can actually see the file.
I tried using xp_cmdshell 'del "F:\EXIS\Reports\Individual.zip"'
But, this asks for a confirmation, which I actually cannot input.
Please suggest if anything,
Thanks.
The message is more generic in the sense the file is not found with the current credentials of SQL Server process while accessing the indicated location.
I suspect it is a problem of rights, so please assure the SQL Server proecess has rights to delete file in that location. An alternative suggestion is to perform a "dir" on that location.
Try executing delin silent mode like:
xp_cmdshell 'del /Q "F:\EXIS\Reports\Individual.zip"'
And also: if SQL Server is running on a different machine the path must of course be valid for that machine.
--change server configuration like :
--Script to enable the XP_CMDSHELL
-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1 GO
-- To update the currently configured value for advanced options.
RECONFIGURE GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1 GO
-- To update the currently configured value for this feature.
RECONFIGURE GO;
DECLARE #BackUpPath varchar(255) ,#sqlQuery varchar(255)
Set #BackUpPath='D:\All DB BackUp\TestDB.bak'
IF dbo.fn_FileExists(#BackUpPath)=1
BEGIN
SET #sqlQuery='DEL /Q "' + #BackUpPath + '"';
PRINT #sqlQuery
EXEC master..xp_cmdshell #sqlQuery
IF dbo.fn_FileExists(#BackUpPath)=0
BEGIN
PRINT 'File Deleted'
END
ELSE
BEGIN
PRINT 'File not Deleted'
END
END
IF #BackUpPath contains space , you must type your path like "your
path"

verifyonly error message

I use following sql statement
RESTORE VERIFYONLY FROM DISK = 'F:\testBackup\test_2013-01-18.BAK'
GO
I get this error while doing so:
Attempting to restore this backup may encounter storage space problems. Subsequent messages will provide details.
The path specified by "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\test.mdf"
is not in a valid directory.
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\test_log.ldf"
failed with the operating system error 3(failed to retrieve text for this error. Reason: 15100).
Msg 3189, Level 16, State 1, Line 1
Damage to the backup set was detected.
Msg 3013, Level 16, State 1, Line 1
VERIFY DATABASE is terminating abnormally.
How do I fix this?
Try to use this:
RESTORE VERIFYONLY
FROM DISK = 'F:\testBackup\test_2013-01-18.BAK'
WITH NORECOVERY,
MOVE 'test_Data'
TO '<YourPath>\test.mdf',
MOVE 'test_Log'
TO '<YourPath>\test_log.ldf';
And you can check MSDN site to further advices.

Ant <Sql> and <exec> sqlcmd - Different Outputs

I have one .sql file that is execute using ant, when I execute it with the tag I recived a different output as when i used calling "sqlcmd".
sql tag output:
[sql] Executing resource: C:\SqlTesting\TestScriptDependencies\Executor.sql
[sql] Failed to execute: Use Library Exec CallSelectSP
[sql] com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name'Libraty.dbo.libraryDocumentType'.
[sql] 0 of 1 SQL statements executed successfully
exec tag output:
[exec] First SP
[exec] Msg 208, Level 16, State 1, Server MyPC-PC, Procedure getFirstDocumentType, Line 3
[exec] Invalid object name 'Libraty.dbo.libraryDocumentType'.
[exec] Second SP
[exec] Msg 208, Level 16, State 1, Server MyPC-PC, Procedure badSP, Line 3
[exec] Invalid object name 'Libraty.dbo.libraryDocumentType'.
And this is the .sql file.
Print 'First SP'
Exec getFirstDocumentType
Print 'Second SP'
Exec badSP
Go
I wonder if it is a way of the SQL tag reproduce the same output as the EXEC tag.
Thanks.
Looks like the first one is submitting the whole script as a single batch via jdbc. Whereas the second appears to be sending each sql statement via sqlcmd - hence the print statements succeed (and result in synchronized output - which is not always guaranteed with print - raiserror(str, 10, 1) with nowait; is the only guarantee of timely messaging) and both sp calls are attempted, each producing their own (sql) error.