Delphi, TAdoConnection, Azure SQL Managed Instance - delphi

I'd like to move the database for several Delphi applications from on-premise SQL Server to Azure Managed Instance. It would use Azure Active Directory Integrated authentication.
We use TADOConnections. I'm having trouble setting the connection string. It looks like TADOConnection does not support Azure Managed Instance and Azure Active Directory Integrated authentication. Is that correct?

Version 18.3 and latter of the Microsoft OLE DB Driver for SQL Server includes the required Microsoft Active Directory Authentication Library (ADAL.dll). Since this traffic is going across the internet keeping this up to date would be a good practice.
Then using the connection string shown for the database on Azure as a starting point you can add Provider=MSOLEDBSQL.1 (plus a ; separator if needed) in the ADO connection string so the above driver is used.

Related

TFS database project for both Azure SQL database and on premises with multiple filegroups

I am working on a project to replicate an application that currently runs on premises to an Azure SQL Database. For the foreseeable future, the application will have to run both on site and on Azure. The project is stored in TFS, and multiple filegroups are specified. Development is ongoing. Is there a way I can maintain this as one project in source control, given that Azure SQL databases only have a primary filegroup? I feel like I can't be the first person in this situation, but I haven't found a decent solution yet.
I'm fine with the Azure database only running on primary, but that is not an option for the local database. This is not for a single deployment, I would like to continue to deploy changes both locally and to Azure from source control. I may be asking for too much here, I just really really want to avoid dual maintenance, when there are a number of teams involved.
Thank you!
You have two options:
Add manual SQL Statements to setup Filegroups on your on-premises SQL Server that don't run against SQL Azure
Use a new feature of Azure named SQL Managed Instances. This is fully managed SQL Server instance running in Azure that supports all features of SQL Server such as filegroups. Don't go installing your own SQL Server on IaaS. That's not necessary anymore with this new feature.
There is no way to use multiple filegroups in Azure SQL Database. If you want to move your database to the cloud and keep the ability to use multiple filegroups, please consider setting an Azure VM with SQL Server on it. Another option would be to change your application so that it does not use SQL filegroups.
As for the replication, please consider SQL Server replication or Azure Data Sync. Azure Data Sync requires an Azure SQL database. It is slower than SQL Server replication but it can handle conflicts.

iOS (Swift) project needs to read an Azure SQL database

I am creating an iOS project that needs to read a SQL database in Azure. I have the database Server location, port, username, and password. I don't need to write to the database, just read it. I am more familiar with Firebase or Parse and have never used Azure. How do I even go about starting this? I tried the sample project that Azure makes for you but I don't have any tables? Do I need this? Any help would be welcome.
Azure Mobile App Service can connect with your existing SQL database
this thread explains the process where you use the existing SQL database. With this option Azure manages most of the inner workings for you.
If you want to build the Rest API from "scratch" using your existing SQL database You have some more options:
Azure API Management allows you to publish API's securely and at scale, A server less Azure Function like the example in this article Rest API with Azure Functions and Azure SQL Database or build a rest API using an Azure Logic App which doesn't require you to write code. You could also use Nodejs or many other tools you just need to evaluate what would work best for your use case.

Trying to connect ASP.NET MVC to SQL Server 2008 R2 with possible wrong connection string

Running SQL Server 2008 R2 and ASP.NET MVC 2 web application on the Virtual Server of big german hosting-provider.
I have a problem to connect to the SQL Server.
On localhost this connection string works fine:
#"Data Source=LOCAL-HP;Initial Catalog=OnlineVertrag;Integrated Security=True";
I'm using a similar connection string on the server:
#"Data Source=MYSERVER\SQLEXPRESS;Initial Catalog=OnlineVertrag;Integrated Security=True";
but nothing happens over there.
Here is my project which I am trying to connect: http://www.hotcont.eu/OnlineVertrag/Home
Based on your comments, your SQL instance on the server has a username/password combination. You cannot use the integrated security connection for a SQL Server connection requiring SQL authentication.
Using the login information provided to you by your host, you should update your connection string to the following:
Server=MYSERVER\SQLEXPRESS;Database=OnlineVertrag;User Id=myUsername;
Password=myPassword;
Taken from ConnectionStrings.com
EDIT
Ok - I think I know what you are dealing with now. You have a virutal machine hosted on a large hosting provider -> meaning that you have control over the machine itself (aka Remote Desktop Management or something?)
The SQL connection string that I provided is for use with SQL server accounts -> meaning those that you actually create within SQL server itself. The SQL connection string that you provided uses the current logged in user's user account information from Windows to connect to SQL.
So here is the disconnection between localhost and the virtual server. When you are running on localhost, I am going to assume that you are using the built in web server to Visual Studio or some equivalent. Most often, during debugging, the web application is running under the Logged in user of the machine - aka: you. You have permission to your own SQL database, thus no issue. BUT...when you deploy your web application to an IIS instance, the web application is no longer running as the logged in user, but rather the identity of the application pool that is your app is a member of. Typically this is something like NETWORKSERVICE.
You have three options available to you
Enable and use SQL user accounts for connection from your web application and your SQL server. If you choose to go this route, you will need to use the connection string I provided above.
Login to your SQL server and add the identity of your application pool to the Allowed Users of SQL server and your database.
Change your application pool's identity to an actual user account on the server (BAD IDEA)
Most web applications go with the first option as it allows you do a few things such as create a distinct SQL user for each application that you host and as well as you can explicitly define permissions for the SQL user to each database that it may need access to (for instance, do not allow the SQL user to DROP tables).
EDIT 2
The way you are trying to connect sounds like it should be using the Shared Memory Protocol, but it might be trying to connect over TCP/IP. I forgot this earlier, but most installs of SQL are not setup to listen on the TCP/IP interface on first install. To check your configuration, click the start button (or orb or whatever Microsoft calls that now) -> All Programs -> Microsoft SQL Server 2008 -> Configuration Tools -> SQL Server Configuration Manager. This will open a new window with some options on the left hand side. Click the SQL Server Network Configuration. Ensure that TCP/IP and Shared Memory is set to enabled. If a 64 bit install, you should probably do this for both the SQL Server Network Configuration (32 bit) and the SQL Server Network Configuration
http://msdn.microsoft.com/en-us/library/ms191294.aspx
Try this
Data Source=MYSERVER\SQLEXPRESS;Initial Catalog=OnlineVertrag;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False
I hope this works for you.

How to connect my local SQL Server to our MOSS 2007 site so I can invoke it in my Sharepoint Designer?

I have asked our IT to do it but couldn't do it right away. Is this a difficult procedure for MOSS 2007 admins? I'm curious about the step by step process to accomplish adding other database connections.
I think I may have found a solution to connect to database using SPD 2007, the secret was to avoid what they call “double hop” between machines on a network. This is resolved by using MOSS 2007 SSO (Single Sign-On) whereby it results to just “one hop” during database calls to web servers.
The SSO needs to be mapped by configuring the Application Definition which only server administrators can create and modify, using the browser-based Central Admin UI.
Can you help set this up using Central Admin UI please? Step by step process is described on this link http://blogs.msdn.com/b/sharepointdesigner/archive/2007/08/27/an-introduction-to-single-sign-on-sso-with-data-views.aspx?PageIndex=2#comments
With Single Sign-On, you can connect to an external database, even if it doesn't reside on the same server as your SharePoint site.
http://office.microsoft.com/en-us/sharepoint-designer-help/add-a-database-as-a-data-source-HA010100908.aspx#BM4

Differences between ADOMD.net and Analysis Services OLE DB Provider (especially regarding authentication)

I'm attempting to connect to a SQL Server Analysis Services cube on a remote server which is not connected to the domain I'm connected to.
I can connect to the cube with Excel after providing username and password. Now I'm trying to connect to the same cube via code.
Unsuccessful connection via AdomdConnection
Using ADOMD.net (AdomdConnection) for SQL Server 2008 R2 I try to connect with this connection string:
Data Source=SRV1;Initial Catalog=Name of Cube;User Id=RemoteAccount;Password=***
This connection fails on the Open method of the connection. Interestingly the "user id" and "password" properties are allowed, because if the syntax was wrong you get a KeyNotFoundException.
Successful connection via OleDbConnection
I can successfully connect if I use OleDbConnection instead and the following connection string (copied from the Excel connection):
Provider=MSOLAP.4;Persist Security Info=True;User ID=SRV1;Password=***;Initial Catalog=Name of Cube;Data Source=SRV1;
So my questions are:
Can someone explain this behaviour? I thought AdomdConnection just used OleDB underneath?
Is there a way to connect to a SSAS
instance with AdomdConnection using
username and password?
Are there any
further differences between
AdomdConnection and OleDbConnection?
All downloads are available here.
I'm using the AdomdConnection succesfully with the username / password keys, but the difference is that I'm connecting to a HTTP data source. The solution I'm using is that I tunnel OLAP traffic over HTTP via IIS 7 as described in MSDN. The user name and password are then impersonated by IIS to Windows credentials.
Note: Disable Anonymous and Windows Authentication in IIS. I only got it working with Basic Authentication. For enhanced security, use SSL.
If you cannot connect the cube with excel, then you cannot connect it with the code.
The difference between ADOMD.Net and OleDb connection is that, the OleDb MSOLAP provider can be used to send MDX, DAX and DMX queries to an Analysis Services database. The result can only be a scalar or a table, so you cannot use an MDX query returning results on more than two axes. When you use a DAX query, the result will always fit well in a table, you can use a DataReader class to get the result.
We prefer mainly ADOMD.NET on OleDb due to the presenceConnection bug which hasn't been resolved.
In order to connect to SSAS instance with ADOMD.NET we need to add the following line in web.config file ( After creation of console application in Visual studio 2012)
Since we will be using Windows authentication to connect to Microsoft Analysis Services 2005, this addition of line in the web.config file is required to impersonate a user having access to the Analysis Services.
We need to configure the IIS server by creating a new application pool.
Following MSDN link will give other parameters of the ADOMD.NET connection String.
https://msdn.microsoft.com/en-us/library/microsoft.analysisservices.adomdclient.adomdconnection.connectionstring

Resources