SQL Server 2008 OLE DB CONNECTION FAILS FROM OUTSIDE - connection

I have a working SQL Server 2008 R2 Express installed on a Windows 2008 server on a cloud machine. All type of connections (ado.net, nhibernate etc.) from several client applications works fine except the OLEDB one. SQL Native Client also works fine.
When I tried to connect from the server locally and as a data source write the instance name, everything was OK. But from outside, I had the problem or also if I write wan ip or dns I had the problem also from local.
-- works perfect from everywhere
Provider=SQLNCLI10;Data Source=mntek.no-ip.org;User ID=xxx;Password=xxx;
-- does not work from anywhere
Provider=SQLOLEDB.1;Data Source=mntek.no-ip.org;User ID=xxx;Password=xxx;
-- works only from local
Provider=SQLOLEDB.1;Data Source=flz001\sqlexpress;User ID=xxx;Password=xxx;
Error: [DBNETLIB][ConnectionOpen (Invalid Instance()).Invalid
connection.
-- works perfect with ado.net
Data Source=mntek.no-ip.org;User ID=xxx;Password=xxx
Some other client applications (not mine) was written with oledb connection so I need them to connect the db with oledb provider.
Any ideas?
Regards,
Mert

It has been a while since this was asked, but I am currently working through an issue related to OLE DB and SQL Server that sounds possibly related.
I found that, even though the server was using the default port (1433), I still had to explicitly specify it in the UDL connection string like this:
Provider=SQLOLEDB.1;User ID=USER;Data Source=IP,1433
I've asked why that might be necessary here:
Why might SQL Server 2008 OLE DB UDL require port 1433 explicitly specified?
Maybe try that and see if it helps.

Related

Unable to access SQL table from appl running as service

I have a small test application, made with Delphi 10.3.1 as an Stand Alone HTTPSYS Intraweb service. It has an ADOConnection and a ADOTable and in FormShow of unit1, I open the connection, and the table and reads the first 10 rows and add them to a listbox. Just to see that it works and is possible.
When running the application as a Stand Alone HTTPSYS, vith visual GUI, it's working nicely, but when I compile it as a service, and install it, on the sql server, or on the development machine, it fails with access Violation, trying to open the table. I suppose it is an Authentication problem.
I have tried to open connection with both Windows Auth, and with a specific SQL login, and I have tried running the service with both local system (default) and with the specific SQL account.
What am I missing ?
The Specific SQL login, works in SSMS. I'm able to use it to login and access my tables.
Also, if I create the application as a DLL and put it on my IIS10, it works fine.
You are right. It has nothing to do with authentication.
For the IntraWeb HttpSys Stand Alone program to run as a service, the ServerController.ComInitialization property must be set to ciMultiThreaded.
Thanks for your comment which lead me to look elsewhere. You do deserve the credit.
Regards
Soren

icCube connect to SQL Express file (.mdf)

I read in this post that it is somehow possible to connect to SQL Express. This post is pretty old and I hope it is still possible somehow to make a connection to a .mdf file (SQL Express database).
How can you set-up a connection to this sort of file?

how to connect UNC-located database to embedded server?

I have next specific situation. I have an application using Firebird embedded server. The files: application executive, database, fbembed.dll are located in the same folder. Everything is good and working good.
Now my client says so:
I would like to place all your application file on a server and run it via local network from all workstations.
So as I see I start application on the server and it starts. But database connection string looks now like:
//SERVER/share/db.fdb
Yes, I know conventions about allowed firebird paths from here: FAQ: What's a connection string?
I do not understand what should I use with embedded server? Is it possible at all?
If you want to access a Firebird database over the network, then you need to install Firebird server and connect through the server. You can't (at least not by default) access a database from a network path, and you really shouldn't (although there is a config option to allow it), as it can lead to database corruption due to insufficient or incorrect filelocking support over the network.
So: Don't use Firebird embedded, but install Firebird server and configure the clients to connect to Firebird server.

Can't Connect to DelphiXE5 AND SQL SERVER 2012

I have a Delphi application that is connected to SQL Server 2012. On my local, I've been able to connect successfully. I've also tried it on another VM, and it work fine. I deployed it on a Server, and it won't connect to the database. I check the connection string; it looks fine. I am not sure what I am doing wrong here.
SQL Server 2012 is installed on a different server
I can reached the server
I check the provider and it's using SQLNCI11
I have SQL Server 2012 Natice Client Install
I check and make sure that the username/password have access to the database, and they can login
What am I missing here?
Despite the fact that you can change the vendor lib in the provider, that change will have no effect as the name of the DLL is hard-coded into the provider. It will try to use sqlncli10.dll, no matter what the property is.
Install sqlncli10.dll and it should work.

MVC 3 Adding a local Database

I am currently going through the MvcMusicSore tutorial (MVC 3). I have full sql server 2008 installed and created a local database by running the SqL scripts included in the MvcMusicStore-Assets data folder. However when trying to add the mdf to the AppFolder in Visual Studio 2010 I get the error Access Denied. I am completely stuck at this point and would appreciate any help to resolve this.
Most probably the mdf file is locked by some other process, not allowing the application to read it. If you mounted the database on SQL Server you need to use a connection string with the machine name instead of specifying the mdf file directly.
You can't copy or modify a live working database. And I don't see why you should.
You need connecting to it? Pick a way. LINQ to SQL, Entity Framework, NHibernate, ADO.NET...
If you really want to copy the database file for some reason, you must first stop the MSSQL Service (or detach the database), then do that.
Like others have said, you shouldn't need to add the actual .mdf into your project. If you have it running on your local SQL Server instance, you should be able to add it via Visual Studio's Server Explorer (plus that gets you your connection string).

Resources