Archive for the ‘Development’ Category

Database Project Deployment — An introduction to the DependencyList

September 26, 2008

Recently, I have been working with Database Projects within Visual Studio 2005 (yes, I’m set in my ways — I haven’t got around to VS2008 yet!!).  I like the ability to source control my creation scripts and stored procedures and I’m happy to use the VS IDE to write my SQL code and running individual scripts against multiple development Database References is a breeze.

However, deploying the finished scripts to a production database is a bit of a nightmare.  Essentially, if each script file represents a single database object, you have to ensure that you run them all in the correct order — especially if you have foreign key constraints (you do have foreign key constraints, don’t you?!).  Ordering all these scripts manually is a royal pain.

After the second or third time of being stuck in this situation, I decided enough is enough and set about writing a small app to do the job for me.  The results of this formed the mighty DependencyList.

(more…)

Advertisements

Oracle service crashes on OracleConnection.Open()

March 4, 2008

We recently had a situation here where the opening of a .NET connection to an Oracle 10g database caused the entire database to crash. This was indicated by the Event Log entry:

The OracleService<SID> service terminated unexpectedly.  
It has done this <n> time(s).

For more information, see Help and Support Center at 
http://go.microsoft.com/fwlink/events.asp.

This was using some library code that we had developed and used successfully on numerous occasions, so it had us truly stumped.

After much soul-searching, one of my colleagues eventually narrowed it down to the length of the .NET project name. The project, when compiled, created a EXE file that had a really long name, which caused Oracle to shit bricks.

Wonderful. I hate how Oracle has such a problem with large object names.

Also, I’d love to know how an Oracle DBA would approach such a failure. How would it even be recorded? There are so many different log files in a standard Oracle installation that I really wonder where you might begin?

Service configuration error – Event ID 5000 (ioibmurhynrxkw0zxkyrvfn0boyyufow)

September 26, 2007

I was recently bugged by an error in a Windows Service I was developing that, when deployed an started, immediately stopped. My log files showed nothing, which suggested that the exception was happening before my logging and exception handlers started.

Examining the Application Event Log, I found the following error:

Event Type: ErrorEvent
Source: .NET Runtime 2.0 Error Reporting
Event Category: None
Event ID: 5000
Date: 26/09/2007
Time: 20:17:53
User: N/A
Computer: theDeploymentServer
Description:
EventType clr20r3, P1 theService.exe, P2 1.0.0.0, P3 46fa9f5d, P4 system.configuration, P5 2.0.0.0, P6 4333ae78, P7 1a2, P8 136, P9 ioibmurhynrxkw0zxkyrvfn0boyyufow, P10 NIL.
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.

Not the most helpful of errors, but I could see the system.configuration entry, so I started with the theService.exe.config file, emptying the file of any meaningful data and adding it back in piece by piece until I recreated the error.

The error occurred on the following appSetting entry:

<add key="PluginsFolder" value="C:\Program Files (x86)\A&B\theService\" />

I realised that the appSetting contained an ampersand (&) witin its value, I realised that ampersand is a reserved character in XML and so the .NET configuration parser couldn’t validate the .config file.

To resolve this I replaced the ampersand with its XML-compliant counterpart (&amp;), so the key now read:

<add key="PluginsFolder" value="C:\Program Files (x86)\A&amp;B Company\theService\" />

Granted this looks a little weird but it solved the problem!

Excessive recompilations when using VirtualPathProvider

September 20, 2007

This is a quick pointer for anyone implementing a VirtualPathProvider in their ASP.NET applications. I’ve read a number of tutorials on VPPs but none really touched on this issue.

If you do not implement a method for VirtualPathProvider.GetFileHash(...), calls to this method will return null/Nothing.

If this happens, ASP.NET’s build/compile system doesn’t remember that it has already compiled the file and attempts to do so again. After 15 compiles, the AppDomain is unloaded and the application restarts. This can cause major irritation, particularly with performance, as the recompiles take time.

To get around it in my app, I am overriding GetFileHash to return a string concatenation of the VirtualFile’s name and Last Modified Date. If anyone knows of a better hash, then please let me know.