Using Oracle.Database M language function in Power BI Desktop - powerbi-desktop

I am writing a custom connector for Power BI Desktop. The custom connector would simply connect to Oracle DB and fetch some data.
For this, I am trying to use Oracle.Database data source function which is defined as below:
Oracle.Database(server as text, optional options as nullable record) as table
Clearly there is no option to pass the DB credentials in the above function.
Questions:
Do we not need to pass DB credentials to this function?
From where this function pick the DB credentials?
Would it be picking up the credentials from Extension.CurrentCredential() function?
Secondly, I have enabled "UsernamePassword" kind of authentication in my connector so when I try to use the connector, it prompts me to supply the username and password. After typing in the username and password, when I click "Connect" button then it simply shows the message "Please specify how to connect". Any ideas why it is showing this message when I have just provided the credentials on the dialog box?

Related

Why am I getting "OLE DB or ODBC Error" when importing data from Azure SQL into Power BI Deskop, using parameters for db details?

I need to connect Power BI to an Azure SQL database. If I enter the server name and database directly into the "SQL Server database" dialog, it connects, prompts me for credentials, allows me to select tables, and subsequently imports data just fine. screenshot of database details dialog
However, if I enter the server and database name as parameters (screenshot of adding database details as parameters), and use the exact same server and db names as the "current value" of the parameters, I get the same table selection options, and can see data previews, as before, but when Power BI tries to import the data, I get the following error:
"Failed to save modifications to the server. Error returned: 'OLE DB or ODBC error: [Expression.Error] The import serverName matches no exports. Did you miss a module reference?" for every table I try to import. serverName there is the name I gave to the server parameter.
error dialog
Can anyone help?

Using Excel as the front end, Azure as the backend

I have a SQL Database on Azure to which I can successfully get connected from within an Excel file. I am using ADO and the connection string uses my own username and password. Since this file will be used by many users, how can I create a generic login and password so that I would not give out my own username and password in the code? The Excel file runs many VBA macros to communicate with the Azure SQL database.
I am using Excel 2010 (yeah, it is old, I have to) and this is my connection string:
mstrConnectionString = "Driver={SQL Server Native Client 11.0};" & _
"Server=tcp:<servername>.database.windows.net,1433;" & _
"Database=<databasename>;" & _
"Uid=<myusername>#<servername>;" & _
"Pwd={MyPassword};" & _
"Encrypt=yes;Connection Timeout=30;"
According your comment, I have an idea that you can create a new login/user for you Azure SQL database.
Then you use this user and password as public account to get or writer data from your Azure SQL database within Excel.
Here's the example T-SQL statement, this code is create a new login and a user in your Azure SQL database. You can run this query in SSMS:
--running in master db
USE [master]
GO
CREATE LOGIN [sagarreadonly] WITH PASSWORD='password'
GO
-- running in Azure SQL DB
USE [DataEncryptDemo]
GO
CREATE USER [sagarreadonly] FOR LOGIN [sagarreadonly] WITH DEFAULT_SCHEMA = Marketing;
GO
EXEC sp_addrolemember 'db_owner', 'sagarreadonly';
GO
The new user is created as 'db_owner' to the specified database.
For more details about database roles, please see Database-Level Roles.
About login and user:
A login is used for user authentication
A database user account is used for database access and permissions
validation.
Logins are associated to users by the security identifier (SID). A login is required for access to the SQL Server server. The process of verifying that a particular login is valid is called "authentication". This login must be associated to a SQL Server database user. You use the user account to control activities performed in the database. If no user account exists in a database for a specific login, the user that is using that login cannot access the database even though the user may be able to connect to SQL Server.
A Login is an identity used to connect to a SQL Server instance. A User allows you to log into a SQL Server database and is mapped to a Login. So you will need to first create a Login, before you can create a User in SQL Server.
Hope this helps.
You can create a "Database login" dialog box to prompt a user for database connection information by using text boxes, buttons, or other dialog box controls. Typically, when you type text in a text box, the text appears as you type. However, you can use a property of the Microsoft Visual Basic for Applications (VBA) Edition User Form to create the effect of a hidden or "masked" text box for creating a password dialog box, where you do not want the text that is typed in a text box to be "visible". Here you will find how to do that.
The information the user types on the "Database login" can be used to build the connection string you posted above.
To create a custom dialog in Excel please follow this instructions.

Sending SQL Reporting server login username & password inside query/post/header

I need to load Report manually in XML to be able to draw custom diagrams from it.
I would be able to load XML but Azure SQL Reporting Server asks for username and password before returning XML.
Is there way to include username and password in header/query/content?

How can a SharePoint SQL connection be set to query by the current login name?

I have a SQL table that needs to be queried by the login name. So, using SharePoint designer I successfully created a database connection, but I can't use the properties exposed by Profile nor Session as input parameters because they are not supported (A dialog pops up with a message indicating this)
How else can I query a SQL datasource by using the current login?
-Edit
To create the data connection, proceed as follows
Open the data source library
Expand database connections and click on connect to a database
Enter the database settings
Select "specify custom Select, Update, Insert, and Delete"
Click on Edit Command
Add a parameter and select Profile and enter UserName as the property name
An error will follow stating that this is not supported.
Unfortunately, you don't give many details but I think you're looking for the LOGON_USER Server Variable: Data View / Data Form: Parameters You Don’t Know About.

Connecting to SSAS 2005 from Excel 2007 over http: how to make it ask for username and password?

I'm trying to let my users connect to OLAP cube in SSAS 2005 using Excel 2007 over the Internet.
I've set up dynamic security using fact table in cube. It uses UserName function, so users should authenticate to SSAS using windows accounts. I've set up msmdpump.dll component on IIS, allowing windows authentication, but not anonimous one. I created windows accounts on web/SSAS server for remote users. My users' machines are out of my control, I can not use pass-through windows authentication.
Now, if I create connection in Excel and save username and password in it, everything works. But I want users to download Excel file without embedded credentials from my web site, and than be able to enter their credentials. Best option is if they will enter password when opening Excel file.
Problem is as soon as I clear checkbox "save password" in connection properties, or remove "User ID"/"Password" properties from connection string, Excel gives me authentication error and does not save connection properties. So I cannot create a template document or connection file without embedded credentials.
Moreover, I suspect, Excel will not ask user for login/password anyway.
Do you know a solution to my problem? Maybe some workarounds/alternative ways? I appreciate any help.
it is really tough to get what you want to work, if at all. I don't think it will work "over the internet" like you want. They would have to be VPN'd in. Their machine doesnt have to be on the network, but they can still pass the AD credentials through.
http://blog.stevienova.com/2008/01/14/how-to-connect-to-sql-server-vs-tfs-etc-using-windows-authentication-when-computer-is-not-on-active-directory-domain-xp-and-vista/
There are other options to expose the cube in some other ways (SSRS, Excel Services, 3rd party OLAP through Web) that would allow you to do what you want.
Here's something that might be worth trying - in your connection string, get rid of the username and password and add 'prompt=1;'. This will force Excel to ask for the user's credentials before it tries to authenticate them, instead of just using empty credentials to do the authentication.

Resources