DBNETLIB ConnectionOpen (Connect()) error with Delphi 2010 application accessing SQL Server 2005 with OLEDB drivers on Windows 7 x64 - sql-server

I built a D2010 application, which uses a TADOConnection component to connect to SQL Server using OLEDB drivers and tcp/ip. The problem is that my application can't connect to the database when I execute it (inside the IDE or not) from a network drive. Each time I try i get this error through the IDE:
---------------------------
Debugger Exception Notification
---------------------------
Project TroisTiers.exe raised exception class EOleException with message '[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.'
---------------------------
Break Continue Help
---------------------------
and I get a "EOleException: Unspecified error" when I run the application outside the IDE.
The thing is, When I copy the .exe on a local drive (C:) it works instantly, no errors, no lag. When I compile the D2010 application on a WinXP computer and execute it from Win7, it also works flawlessly. When I take the .exe I builded and execute it on a x86 Windows 7, I get the same errors as above.
I noticed that when I start the application on the network drive, the following modules are loading:
Module Load: WSHTCPIP.dll. No Debug Info. Base Address: $74CD0000. Process TroisTiers.exe (848)
Module Load: WSHIP6.dll. No Debug Info. Base Address: $74010000. Process TroisTiers.exe (848)
Module Load: DBnmpntw.dll. No Debug Info. Base Address: $750C0000. Process TroisTiers.exe (848)
I have asserted that the app tries to connect using TCP/IP first, then for whatever reason resorts to named pipes. Just for tests, I activated the named pipes protocol on the server and it started to work but not every time and takes up to 10 seconds before the connection is made. I deactivated it since it's not the way we connect to the production databases. When the app is executed locally (and showing data correctly), the DBnmpntw.dll module is neved loaded.
When I build a connection string (through a .udl file) and test the connection, it works, though I am not certain if I'm testing through the 64bit or 32bit drivers.
Setting the .exe output directory to my local drive is an acceptable work-around for now but I would really like to know what's causing this problem, as it makes things complicated with working in an up-to-date environment (additionnal files beside the .exe).
Additionnal info, for what it's worth:
My connection string: 'Provider=SQLOLEDB.1;Persist Security Info=True;User ID=*;Password=hunter2;Initial Catalog=[database name];Data Source=[server ip address]'.
I tried to force using TCP/IP with "Network Library=DBMSSOCN;" but it doesn't help.
Firewalls disabled on my computer and on the server;
McAfee AV on my computer, managed through ePO;
SQL Server 2005 x64 running on Win2k3 x64;
Windows 7 without SP1 installed;
cliconfg.exe -> active protocol is tcp/ip only;
I can provide additionnal info if needed.

Is your .EXE too large for running on a network shared drive? I have the same experience when the size of .EXE exceed 25MB or something closed to.
The solution is simple, just to move the .EXE back to local drive.

Related

How to resolve Runtime error no transaction is active?

I am dealing with a legacy program written in Visual Basic the source code of which is unfortunately unavailable to me. The set up I have is the following.
There is a server, lets call it S, and two client computers, A and B.
The application is a basic CRUD application, lets you view, add, update and delete fields from the server S.
The program is installed on both A and B and works fine on A,
however on computer B while doing some operation such as requesting a certain table from server S I get
Run time error - no transaction is active
EDIT
I have tried turning off, uninstalling and installing MSDTC, made sure that DCOMCNFG TCP/IP is selected.
Has anyone encountered this problem?
If the program works on one computer but not on the other, and NetBios is active, MSDTC is active too, then it's an issue with the software not winsock or the server. Try running the program in compatibility mode of the last known windows that it is know to work on. (Usually it is win xp sp3).

Connection String times out with network name, yet works with IP

Machine 1
Windows Server 2008
SQL Server 2008
The database. Contains all the information our sites use.
Machine 2
Windows Server 2012
IIS 8
The webserver. Uses IIS to host two sites:
Production site: (default) Has the most up-to-date UI and features
Backup site: Older UI, but still using the latest data from Machine 1
Here's how it works:
User goes to one of the sites hosted on Machine 2 and enters their company information
Machine 1 is queried for that company's connection string.
The site uses the connection string to connect to the correct database on Machine 1.
The problem is that about 1/3 of the connection strings use the network name (e.g. "Data Source='Machine1';") while the other 2/3 use the IP address (e.g. "Data Source=192.168.1.200;"). When connecting via the Production site, a timeout occurs if uses a connection string with a network name. However if the same user, using the same credentials, logs in to the Backup site, everything works fine regardless of which 'Data Source' is used.
I created a simple Powershell script to test the connection from Machine 2; network names and ip addresses both work, which makes me suspect it is an IIS or web.config issue. I've gone through both extensively, and these are the only differences I've noted:
Different Application Pools in IIS: However when I ran "Get-CimInstance Win32_Process" it showed both instances of w3wp.exe had been started with the same command and arguments (with the exception of different pipes)
Slightly different web.config. The Backup site has an entirely self-contained web.config, while the Production on stores its connection strings is a separate file.
Been banging my head against this for several days. Very limited in the steps I can take considering this a production website and
Database. Any advice is appreciated.
Try putting the network-library in the connection string to force tcp.
see connectionstrings.com/define-sql-server-network-protocol
;Network Library=DBMSSOCN;
PS
Yep. Been there, done that. 4 days of "on site" client visit.......and it was the protocol.. Thus how I learned to force it via the connection string. You can also try this:
Create a (temporary) System DSN (ODBC in Control Panel) with a weird name like "peanutbutter". There is a client connection button in there somewhere. Force it to tcp. Then search your registry for peanut butter and find out how the network library gets stored.
A picture is worth a thousand words. See left side of image below. (a random image from the old interweb)

Msmdpump.dll OLAP data pump is throwing a 500 error

How do I resolve this issue with requests to msmdpump.dll for connections to SQL Server Analysis Services? I am receiving a 500 Error from the IsapiModule.
On a Windows Server 2012 R2 machine, with IIS 8.5, I have setup the OLAP data pump (msmdpump.dll), using the following instructions: https://msdn.microsoft.com/en-us/library/gg492140.aspx#bkmk_copy
The application pool is configured for .NET CLR v4.0, with Classic Managed pipeline mode. The identity is set to a local service account. (I have also tried a domain account, and I have tried making the local user an Administrator).
I've created an application under the Default Web Site, called OLAP, with an IsapiModule, as per the MSDN article.
As far as I can tell (and I've double and triple checked), everything is configured as laid out in the MSDN article. Also, compared to another server where I have this setup (on a different network), it is essentially the same.
When I request http://localhost/OLAP/msmdpump.dll in a browser on that machine, I receive a 500 Internal Server Error. The error indicates that it is trying to use the OLAP handler that I created. This is not the same error that I would normally expect when doing a GET request to msmdpump.dll. The normal error for a straight GET, when everything is working correctly, is sent back in a SOAP envelope. In my case, the request does not appear to ever be processed by msmdpump.dll.
500 Internal Server Error via browser:
(see below for full screenshot)
Module IsapiModule
Notification ExecuteRequestHandler
Handler OLAP
Error Code 0x8007007e
Requested URL http://localhost:80/OLAP/msmdpump.dll
Physical Path C:\inetpub\wwwroot\OLAP\msmdpump.dll
Logon Method Anonymous
Logon User Anonymous
500 Internal Server Error via SSMS connection:
I also receive an error when trying to connect to the data pump via SQL Server Management Studio:
Screenshot of the 500 error in the browser:
One appreciable difference between the machine I'm setting up, and the server where the data pump already works, is that there are a few more roles setup on the new server.
The problem server includes:
.NET Extensibility 4.5
ASP.NET 4.5
While the other machine (where the data pump works), does not include those roles. Would the presence of ASP.NET 4.5 or .NET Extensibility 4.5 cause an issue with IIS serving requests for this IsapiModule?
Quick answer
In my case installing KB3138367 (https://support.microsoft.com/en-us/help/3138367/update-for-visual-c-2013-and-visual-c-redistributable-package) resolved the issue.
Longer answer
There are a few debugging steps that can be useful.
Configure IIS tracing
For full instructions see: https://learn.microsoft.com/en-us/iis/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis
However, you can ignore the parts where it tells you to delete your existing content - they're going a little overboard there to ensure you get the same results in the tutorial. Just add the failed request tracing to your existing site, catching "500" status codes.
In my case, that led me to the result:
ModuleName IsapiModule
Notification EXECUTE_REQUEST_HANDLER
HttpStatus 500
HttpReason Internal Server Error
HttpSubStatus 0
ErrorCode The specified module could not be found. (0x8007007e)
I confirmed that my handler mappings had the correct path to msmdpump.dll, but still got the error. So time for the next debugging step:
Use Sysinternal Process Monitor to check w3wp.exe
Process monitor is a free tool from Microsoft: https://learn.microsoft.com/en-us/sysinternals/downloads/procmon
Use Process Monitor to log file system access (filter on the "w3wp.exe" process to avoid being overwhelmed)
Look for NAME NOT FOUND and PROCESS NOT FOUND results. There will be a number of these as the system attempts to e.g. locate various dlls, so it is normal to see some NOT FOUND results followed by SUCCESS results for the same filename. You are looking for NOT FOUND results that do not have any corresponding SUCCESS results.
In my case, this highlighted two dlls:
msvcr120.dll
msvcp120.dll
These turn out to be part of the “Microsoft Visual C++ 2013 Redistributable” package (https://superuser.com/questions/1163409/msvcp120-dll-and-msvcr120-dll-are-missing).
However, "Add/Remove Programs" showed that the package was already installed. Running "repair" on the package did not resolve the issue.
Locating the dlls
In my case, the OLAP pump is installed an a web server separate from Analysis Services.
Running these powershell commands:
Get-ChildItem -Path 'C:\' -Recurse -File -Filter 'msvcr120.dll' -ErrorAction SilentlyContinue | select -ExpandProperty DirectoryName
Get-ChildItem -Path 'C:\' -Recurse -File -Filter 'msvcp120.dll' -ErrorAction SilentlyContinue | select -ExpandProperty DirectoryName
yielded some interesting results. On the web server, the dlls only showed in C:\Windows\SysWOW64.
However, on the server where Analysis Services was installed, the dlls were present in both C:\Windows\System32 and C:\Windows\SysWOW64 (as well as a few other sql server paths)
(as an aside, SysWOW64 contains 32 bit dlls, and System32 may contain 64 bit dlls. So simply copying from SysWOW64 to System32 is likely to cause you problems. See https://www.howtogeek.com/326509/whats-the-difference-between-the-system32-and-syswow64-folders-in-windows)
I could see from the Process Monitor logs on the web server that one of the search paths was C:\Windows\System32. A little more searching led to KB3138367 (Installing both Visual Studio 2013 Redistributable packages (x86 & x64) at the same time)
The actual KB text (https://support.microsoft.com/en-us/help/3138367/update-for-visual-c-2013-and-visual-c-redistributable-package) describes the issue:
When you install an updated redistributable package, binaries for
non-target architectures are removed. For example, after you install
an update for an x86-based application, the x64 Visual C++ 2013
runtime libraries are missing. This fix makes sure that both versions
of the Visual C++ redistributable are visible when you add or remove
programs after installation of the update.
You should probably disable Anonymous Authentication on IIS
This is the perfect article, as expected to see on stackoverflow! I even thought that this case is also mine, but thorough checks shown my problem was crushing msmdpump.dll, and that crash was an exception, caught internally by msmdpump.dll. The only visible clue was a message in Windows Application log stating "an internal error happened" (or smth. alike). Googling alot didn't bring any valuable results, but suddenly this article gave me an idea to check for the LATEST MSQL cumulative update from here, and, after installing it and re-coping msmdpump.dll the crash was gone and cubes finally shown up as expected in SSMS interface. Needless to say that all issues with IIS Identity Pool, double-hop and other security-related stuff was rechecked many times with no success... Realizing that exception is inside the dll itself take some time to come...

Error code 2 starting OracleDbConsole service

I installed Oracle DB 11g,
everything was working well, but suddenly process
OracleDbConsoleorcl didn't start anymore, I try
manually but it always shows this message:
Windows could not start OracleDbConsoleorcl on
Local Computer. If this is a non-Microsoft service,
contact the service vendor, and refer the service
specific error code 2
What should I do??
You can use the following command to check the issues/configuration status of OracleDBConsoleorcle:
emctl status dbconsole
You can then configure accordingly.
Oracle 11g: Windows could not start the OracleDBConsoleorcl on Local Computer
I was using the Oracle 11g in my Windows 7 Professional system for few days.. Suddenly, I was not able to use the sql developer to connect the schema/user.
I found that the Oracle... services were down in the Windows services windows.
a) Oracle ORCL VSS Writer Service - running
b) OracleDBConsoleorcle - not running
c) OracleJobSchedulerORCL - not running
d) OracleServiceORCL - not running
When I started the OracleDBConsoleoracle, it thrown a error "Windows could not start the OracleDBConsoleorcl on Local Computer".
(Below solution is worked for me, based on the various fo rum threads)...
a. go to C:.......\product\11.1.0\db_1\oc4j\j2ee
b. copy paste the folder: OC4J_DBConsole_192.168.x.y_orcl, two times
c. rename one of the two new folder as OC4J_DBConsole_localhost_orcl
d. rename the other one as OC4J_DBConsole__orcl
after making these changes and a reboot, it started to running.........
In my case was the server IP was changed, I've placed the IP back and It's working!

SQL Server 2008 Filestream Win32 error without a network cable!

I have a SQL Server 2008 database utilizing Filestreaming and all works fine and dandy apart from under one very strange circumstance. If i have my database on, say a laptop, on a locally installed version of SQL Server 2008 and am connected to the network all works fine. If i unplug the network cable, after a while the SqlFileStream class fails to initialize with a Win32 exception (everything else about connecting to the database works fine). If i start fresh without a network cable it will not work with the same error. If i plug a network cable in even with no network connectivity it works... take it out, nothing.
I'm connecting to the filestream in the usual documented method
SqlFileStream fileStream = new SqlFileStream(path,
context,
FileAccess.ReadWrite,
FileOptions.SequentialScan,
0);
geting the path and context from a stored procedure which generates them in the following
SELECT Data.PathName(), GET_FILESTREAM_TRANSACTION_CONTEXT()
FROM dbo.DocumentFiles
WHERE [File_ID] = #FileId
I'm getting the following error when creating the SqlFileStream instance
Win32Exception occurred The network
location cannot be reached. For more
information about network
troubleshooting, see Windows help.
No inner exception.
I have tried so many things to resolve the issue with no luck. no one in google-land seems to have the same issue so obviously something silly I'm doing. If anyone can shed any light on this i would be most grateful.
James
Hmm. It looks like your network interface goes down when you unplug your cable. When it happens TCP/IP stack goes down as well since there's no more available interfaces left. I suggest you to to install the MS Loopback adapter, this article explains how to do it in Windows XP; it is easy to google about how to do it in other OSes. Do not forget to assign a static IP to it after installation, private address like 192.168.1.x would be sufficient. Since loopback adapter is a virtual one, it is in "Up" state all the time, even when you unplug your cable and it prevents Windows from shutting TCP stack down.

Resources