Thursday, June 21, 2007
Wednesday, June 20, 2007
Enterprise Library and Oracle
Enterprise Library is a very useful framework that Microsoft gives away for free :) If you build a .NET application, of course ;)
Enterprise Library Data Access module offers an alternative to a self-written data access layer. And, as suspected, it doesn't only support Microsoft SQL, but also Oracle and other databases. Unfortunately, this is pretty much what you get in the Enterprise Library documentstion about Oracle connections - it can be done.
I first started with the EL Configuration Tool - easy to use and up front. The result was a web config file that I added to an ASP .NET application and then ran it. Surprise - it didn't work :). The error was "... an Oracle 8.* Client must be installed on the machine". What the documentation of the EL didn't say was that, in order to connect to Oracle, if the application is NOT running on the same server that Oracle is installed, then you need to install the Oracle Client Tools on the application server. The Client Tools install drivers that the .NET framework needs in order to access the database, and thus, the data. So I installed Oracle Client tools on my machine, according to what MSDN says here. I ran the application - error. Same error. I restarted the computer (
) and ran the application again - error.
But to end your pain :) here is the solution:
SCENARIO: .NET Application with Oracle Database. The two are installed on diferent servers. What you have access to is the application server.
SOLUTION: the server running the application must have installed:
-
Oracle Client Tools
-
Oracle Data Provider for .NET
The application web.config file must contain the section:
< add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDatabase, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="System.Data.OracleClient" / >
Thursday, June 14, 2007
Flickr Photos
www.flickr.com
|
Tuesday, June 12, 2007
Atlas and Custom Errors
If you use Atlas versions of ASP .NET AJAX, it is a known fact that you cannot redirect the user server-side from an event raised by a control that is in an Update Panel. We can find ways to deal with this problem, but what happens in the particular case of Errors?
Error handling code often implies using Application_Erorr function in Global.asax and automate redirection to a page where an error message is posted - "An error has occurred. The administrator has been notified" is my favourite :) (with DB logging of course)
If an error occurs within a post-back triggered by a control in an Update Panel, we may be surprised to see that the user is not redirected anywhere and the error is shown in an alert message box.
Solutions? First of all, let the error be handled by the Application_Error code. For that you can use one of the Script Manager events. There you just throw the exception:
Protected Sub ScriptManager_PageError(ByVal sender As Object, ByVal e As Microsoft.Web.UI.PageErrorEventArgs) Handles ScriptManager.PageError
Throw e.Error
End Sub
Second, you would also like the redirect to work - unfortunately, only .NET Ajax offers a solution for that - the Script manager has a property called AllowCustomErrors that, when set to true, allows the application to handle errors through the Custom Errors settings in web.config. More details here.









Recent Comments
Starting form the sample I mentioned
Thanks for posting this. It sav
The left image does not overlap t
Was Looking for the "inline" and "at