Infragistics ADOMD ClassCastException when connecting to ActivePivot's XMLA server - c#

I am trying to edit the Infragistics WPF PivotGrid Sample so that it will connect to the ActivePivot Sandbox Server. ActivePivot supports XMLA and I can connect to the same Sandbox Server using the 'From Analysis Services' DataSource option in MS Excel with no issues. I edited the odc file to match the exact same connection string as below and it sill worked.
In the DataSourceAdomdNet.xaml file in the Infragistics.Samples.WPF project, I replaced the AdomdDataSource with the following:
<igOlap:AdomdDataSource x:Key="AdomdDataSource"
Database="Sandbox"
Cube="EquityDerivativesCube">
<igOlap:AdomdDataSource.ConnectionSettings>
<igOlap:AdomdConnectionSettings ConnectionString="Password=admin;Persist Security Info=True;User ID=admin;Initial Catalog=Sandbox;Provider=MSOLAP.4;Persist Security Info=True;Data Source=http://localhost:8080/xmla;MDX Compatibility=1;Safety Options=2;MDX Missing Member Mode=Error" />
</igOlap:AdomdDataSource.ConnectionSettings>
</igOlap:AdomdDataSource>
When I run the Samples project and look at the PivotGrid, I see the following exception:
InnerException: System.InvalidCastException
HResult=-2147467262
Message=Object cannot be cast from DBNull to other types.
Source=mscorlib
StackTrace:
at System.DBNull.System.IConvertible.ToDateTime(IFormatProvider provider)
at System.Convert.ToDateTime(Object value, IFormatProvider provider)
at Microsoft.AnalysisServices.AdomdClient.CubeDef.get_LastProcessed()
at Infragistics.Olap.Adomd.AdomdDataProvider.LoadCubesWorkerDoWork(Object sender, DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
InnerException:
I am experienced with ActivePivot, but not so much with Infragistics/ADOMD.NET. I have never seen this type of error when using any other XMLA/ADOMD client with ActivePivot.
Can anyone help?
Thanks

Related

IBM.Data.DB2.Core error in new DB2Connection(connectionString)

We have the IBM.Data.DB2.Core (3.1.0.300) nuget package installed in our .netstandard2.1 application library, to connect to an external DB2 instance on prem.
On running the following code from a .net core azure function v3 Windows 64bit (from a netcoreapp3.1 project)
var connectionString= "Server=DB2_IP:DB2_Port;Database=DB2_DBNAME;UID=DB2_UserId;PWD=DB2_Password;"
var connection = new DB2Connection(connectionString);
(note the values in the connection string are placeholders for anonymity)
We are receiving the following error
IBM.Data.DB2.Core.DB2Exception (0x80004005): ERROR [58005] [IBM][DB2.NET] SQL0902 An unexpected
exception has occurred in
Process: 21308 Thread 33 AppDomain: Name:Microsoft.Azure.WebJobs.Script.WebHost
There are no context policies. Function: AESEncryptADONET (Encryption Info)
CallStack: at System.Environment.get_StackTrace()
at IBM.Data.DB2.Core.DB2ConnPool.HandleUnknownErrors(String strFncMsg, Exception exception, Boolean bThrow)
at IBM.Data.DB2.Core.DB2ConnPool.EncryptString(String value)
at IBM.Data.DB2.Core.DB2ConnPool.ReplaceConnectionStringParms(DB2Connection connection, String szValue, DB2ConnSettings& pSettings, DB2ConnSettingsInternal& pSettingsInternal, Boolean bAttach, Boolean pushDownStrAppended)
at IBM.Data.DB2.Core.DB2Connection.set_ConnectionString(String value)
at IBM.Data.DB2.Core.DB2Connection..ctor(String connectionString)
Does anyone have any idea where we're going wrong, or alternatively have a coherent end-to-end guide on the setup that may give me a clue.
All documentations I have found thus far has been rather sparse and a little inconsistent.

Exception when trying to reference Azure Analysis Service Tabular Model C#

The problem I get is an exception when I try to reference Azure Analysis Service Tabular Model.
Message=The value '2' is unexpected for type 'DataSourceType'.
Source=
StackTrace:
Microsoft.AnalysisServices.Tabular.ObjectFactory.CreateDataSourceFromRowset(IPropertyReader reader)
at Microsoft.AnalysisServices.Tabular.DdlUtil.LoadDataTable(ObjectType objectType, DataTable table, DictionaryobjectMap, StringComparerInfo comparerInfo)
I found the same problem here Exception when referencing SSAS Tabular model in C# but there is no solution for it.
Microsoft.AnalysisServices.Database db =
SSASConnection.Instance(Parent.Name).Databases.Find(Id);
if(db.Model != null) // Here it breaks!!!
I found a solution for this.
The problem was that I used Microsoft.AnalysisServices.dll 13.0.0.0 version
I updated it to Microsoft.AnalysisServices.dll 14.0.0.0 version and now all works fine.

Exception after upgrade to Creator Edition

The following line of code worked fine up to yesterday.
ReportViewer1.ServerReport.GetParameters().Count
My PC updated overnight to the 'Creator Edition' of Windows 10, and now I get the exception shown below...
'ReportViewer1.ServerReport.GetParameters()' threw an exception of type 'System.Net.WebException'
Data: {System.Collections.ListDictionaryInternal}
HResult: -2146233079
HelpLink: null
InnerException: {"No connection could be made because the target machine actively refused it 127.0.0.1:80"}
Message: "Unable to connect to the remote server"
Response: null
Source: "Microsoft.ReportViewer.WebForms"
StackTrace: " at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.GetSecureMethods()\r\n at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.IsSecureMethod(String methodname)\r\n at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.SetConnectionSSLForMethod(String methodname)\r\n at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.ProxyMethodInvocation.Execute[TReturn](RSExecutionConnection connection, ProxyMethod`1 sql16Method, ProxyMethod`1 katmaiMethod, ProxyMethod`1 yukonMethod)\r\n at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.LoadReport(String Report, String HistoryID)\r\n at Microsoft.Reporting.WebForms.SoapReportExecutionService.LoadReport(String report, String historyId)\r\n at Microsoft.Reporting.WebForms.ServerReport.EnsureExecutionSession()
\r\n at Microsoft.Reporting.WebForms.ServerReport.GetParameters()"
Status: ConnectFailure
TargetSite: {System.String[] GetSecureMethods()}
Has anyone else seen this happen? Any ideas why? Thanks
After a few re-boots, this started working.
Maybe the Reports system didn't re-start itself after the update...

Assuredly simple C# file saving issue

We have a custom built web application built on ASP (2.0 it looks like) using C#. We recently moved it from an IIS6 environment to an IIS7. We have run into an issue where a page set up to view images that had been retrieved via a search is throwing an error. The code takes a copy of the image file and puts it into a work directory renaming the copy to the user's name.
bmpList[0].Save("c:\\inetpub\\wwwroot\\SiteName\\Work\\" + ((ImageUser)Session["ImageUser"]).Username + ".TIF", info, encParams);
I know that the wwwroot is no longer a valid directory in the path so I changed it to...
bmpList[0].Save("c:\\inetpub\\SiteName\\Work\\" + ((ImageUser)Session["ImageUser"]).Username + ".TIF", info, encParams);
Saved the file, did and IIS restart and cleared my browser cache and still receive an error...
A generic error occurred in GDI+.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
Source Error:
Line 180:
Line 181: //bmpList[0].Save("c:\\pi\\" + ((ImageUser)Session["ImageUser"]).Username + ".TIF", info, encParams);
Line 182: bmpList[0].Save("c:\\inetpub\\wwwroot\\SiteName\\Work\\" + ((ImageUser)Session["ImageUser"]).Username + ".TIF", info, encParams);
Line 183:
Line 184: for (int a = 1; a < numFiles; a++)
Source File: c:\inetpub\Sitename\SiteApp\View.aspx.cs Line: 182
Stack Trace:
[ExternalException (0x80004005): A generic error occurred in GDI+.]
System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) +615209
View.Page_PreRender(Object sender, EventArgs e) in c:\inetpub\SiteName\SiteApp\View.aspx.cs:182
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
System.Web.UI.Control.OnPreRender(EventArgs e) +11056766
System.Web.UI.Control.PreRenderRecursiveInternal() +108
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394
It seems like a fairly straightforward thing but for some reason it is not updating (the path in the error remains exactly the same). What am I missing?
Almost all the time (i.e 99.9999% of the times), when using GDI, 'a generic error occured' means that the directory you are trying to save to doesn't have the proper permissions. Typically, you need to make sure that directory is allowing asp.net to modify files. Did you check the permission on the directory you are trying to save the files to?
So oddly enough the answer is actually as simple as it looks... almost.
Changing...
c:\inetpub\wwwroot\SiteName\Work\
to...
c:\inetpub\SiteName\Work\
worked. Why it was continuing to give me the same error from the browser after I changed the code on the .cs file was that the IP that they had bound to the site still belonged to a previous version of the machine so DNS was routing me over to that box instead. All said it ended up I was on the wrong OSI model layer. I only discovered it when I went to build a test version on the same box and went to unbind the IP from the broken site and bind it to my second test site and I found that the IP I wanted wasn't an option (so it must have been manually entered). Live and learn. Thanks for the input and advise.

"Invalid Argument" exception message on IBM.Data.DB2.DB2Connection .open method

So I'm getting a fantastically descriptive error message of "Invalid Argument" when trying to hook up to a DB2 database. I can successfully connect to it using SQUirrel (and JDBC) using the JTopen JDBC driver with the connection string of "jdbc:as400://server;naming=system;errors=full;prompt=no"
Since the jdbc connection works, I know its a Db2.net connector issue. But the error message "Invalid Argument" frustrates any efforts into diagnosing where to begin.
string connStr = "server=server;uid=user;pwd=password";
using(DB2Connection conn=new DB2Connection(connStr))
{
conn.Open();
//System.ArgumentException: Invalid argument
// at IBM.Data.DB2.DB2ConnPool.ReplaceConnectionStringParms(DB2Connection connection, String szValue, DB2ConnSettings& pSettings, DB2ConnSettingsInternal& pSettingsInternal, Boolean bAttach)
// at IBM.Data.DB2.DB2Connection.set_ConnectionString(String value)
// at IBM.Data.DB2.DB2Connection..ctor(String connectionString)
// at AuroraDAL_ConnectionTests.DB2ConnectionTests.try1() in C:\Projects\...\DB2ConnectionTests.cs:line 31
// at AuroraDAL_ConnectionTests.DB2ConnectionTests.Execute() in C:\Projects\...\DB2ConnectionTests.cs:line 19
// at AuroraDAL_ConnectionTests.Program.Main(String[] args) in C:\Projects\...\Program.cs:line 20
}
Using the testconn20.exe within the DB2.net connector program files directory, I tried several options, taking the first connection string above, to then changing the shorthand keys to their longhand values, (uid changed to user id, pwd changed to password, etc)
testconn20 server=server;database=database;user id=userid;password=password
the result of that returns the same "Invalid Argument" exception eventually:
Step 1: Printing version info
.NET Framework version: 2.0.50727.5448
64-bit
DB2 .NET provider version: 9.0.0.2
Capability bits: ALLDEFINED
Build: 20090522
Factory for invairant name IBM.Data.DB2 verified
Elapsed: 0.089982
Step 2: Connecting using "server=-------;database=------;userid=------;password=------"
Invalid Argument Exception:
Connection string should be of the type 'Database=db2db; Server=mymachine:60000; User ID=db2user; Password=xxxxxxxx
Test failed.
Does anybody with some DB2 and C# have any suggestions as to what i'm doing wrong? THanks in advance.
I have no DB2 experience, but looking carefully at your code I noticed that you don't specify the Database= and the PortNumber in Server= of your connection string
It appears that IBMs site doesnt direct you to latest and greatest bits of their .net data connector. The problem was mostly solved by thoroughly looking for updates and finding their "Fix Central". This is where they keep updates and hot fixes. However it was not easy to get the right package.
finally I create the correct connection string:
Database=DBNAME;Server=IP:PORT;UID=USERNAME;Pwd=MYPASSWORD;LibraryList=LIBRARYNAME;PersistSecurityInfo=True;
For more parameters consult this: DB2Connection.ConnectionString property
https://www.ibm.com/docs/en/db2/9.7?topic=properties-connectionstring

Categories

Resources