Thursday, July 3, 2008

OracleXETNSListener colud not be started

I have been using Oracle XE for months and suddenly one day I could not connect to the database. I found that the listener was not running and I attempted stop and then start the listener through the menu options(Programs->Oracle 10g Express Edition->Start Database,StopDatabase). The listener did not start.

I found many forums that talked about the same issue. Different solutions worked for different people. I tried all the solutions that were recommended but none of them really fixed my problem. One of the forum recommended reinstalling OracleXE. (Note: reinstalling will wipe out any database that you already have on XE). There are instuction to get around this problem, see Oracle XE Installation instructions for more info. So I decided to reinstall Oracle XE but it is not as straight as one might think. Here are the steps that I followed

1. login to the machine as administrator (this seems to be very important). You may be thinking your domain account as local administrator rights. That doesn't really matter. Oracle requires you to login as adminstrator of the machine.

2. Run Oracle XE setup exe. You will be prompted to either Repair or Remove. Choose Remove.

3. Complete the remove process.

4. Open Environment variables (My Computer->Properties->Advanced->Environment Variables)

5. Remove ORACLE_HOME and ORACLE_SID system variables (This is very important. My previous attempt without this step did not fix my problem)

6. Reboot the machine. (one more important step)

7. Log in as administrator

8. Install Oracle XE

That's it! You should be able to open Oracle Home.

Drop couple of lines if this worked for you.

Thursday, June 5, 2008

Cannot open Oracle XE database home page

Sometimes when you install Oracle XE on your desktop and try to access the home page through the internet explorer, it may not open and IE displays an error page. There are two things that seem to fix the problem

1. When you install Oracle XE on your desktop, login as local administrator instead of your company domain account. The install instruction says as long your domain account has administration rights on the computer it will work. But that's not the case when I installed XE. So I uninstalled oracle xe, logged off as domain user, logged back-in as local adminstrator.

The username for local administrator is usually "administrator." If you don't remember the password, you can just reset it by logging in as domain user.

If you are trying to open the database home from a different machine than the machine running Oracle XE, you may want to do the following

1. Make sure remote connection is allowed to this database. For that you will have to goto the machine where the database is running and change the setting. The option is available under administrative task.

2. Also make sure the firewall is not enable on machine where the database is running. If the firewall is enabled, it may block the calls to communicate with the database. Chaning the fire wall settings is very easy. Select the LAN connection properties. Click advanced tab and then click settings. Here you can enable\disable firewall.

Thursday, November 1, 2007

Automation Error System cannot find the file specified

You might run it to this problem when you are trying to load a COM exposed .net component from a COM application such as VB. The problem is that the COM is not able to find your component in the registry. Here are some of the resolutions you can try

- Enable Register for COM interop in the project properties window

This use to be enough in .Net 1.1 /VS 2003 to get the component registered. But in .Net 2.0/VS 2005, Microsoft introduced another way to specify the COM visibility. That is by introducing a new attribute [assembly: ComVisible(true)]. Add this attribute to your AssemblyInfo.cs file and recompile the project.

If you are still having the problem, try registering the component explicitly using

regasm c:\abc\abc.dll /tlb

sometimes the /tlb option does the trick.

If this doesn't fix the problem check the version number of the component on which your component depends on. If the components, on which your component depends, are singed with specific key and are of specific version, then your component also need to be signed with the same key and versioned the same. Otherwise you will get the same automation error when loading from the component from a COM client. In .Net2.0 you update the AssemblyInfo.cs to update the version number and sign the component

e.g.

[assembly: AssemblyVersion("x.x.x.x")]
[assembly: AssemblyFileVersion("x.x.x.x")]

[assembly: AssemblyKeyFile(@"your_key.snk")]

Hope this helps.

Tuesday, September 11, 2007

Accessing network resource with in a Windows Service

Recently I ran into this problem where my windows service running under local system account could not access network resources such as shared folders. After googling a bit, I found Microsoft article that recommended running the service under "Network Service" account instead of System account when the service requires access to network resources. That sounds reasonable.

After applying the changes run my service under Network Service account, I realized that now my service cannot access local files. That means the services running under Network service can only access network resources but not local resources. I am not sure what's the motivation behind it though.

Next I tried creating a user defined account with the permission to access files both locally and remotely. I made my service to run under this new account. But still the service is not able to access network resources.

If I convert the service to a standalone EXE and run it, it is able to access network resources.

I have two more solutions to try. One of which is to update the windows service to impersonate another user through the code. Another solution is to map the driver within the service before accessing such drives. I am not sure how this might work out, I will keep you guys posted.

If you have a solution, your input will be much appreciated.

Tuesday, July 24, 2007

warning MSB3214: "*.dll" does not contain any types that can be registered for COM Interop.

Sometimes when a .Net assembly is made COM visible, you might still see MS Visual Studio 2005 complaining

warning MSB3214: "*.dll" does not contain any types that can be registered for COM Interop.

We know we can make a assembly COM visible by

  • adding [assembly: ComVisible(true)] in AsseblyInfo.cs
  • specifying [ComVisible(true)] attribute for the classes that need to be made com visible
  • and also checking the "Register for COM interop" option in project properties window under Build tab

After all these changes you might see Studio still not able to create the TLB for the assebly. In other words not able to register the assebly for COM interop.

Resolution:

I have not found the actual cause of the problem. But following workarounds have fixed the problem

  • Somtimes closing the project and then reloading fixes the problem.
  • Open the command prompt and try registring the component with regasm command. Makre sure you are using the /tlb option. Without it you would get RegAsm : warning RA0000 : No types were registered

The command would look something like

C:\Program Files\Microsoft Visual Studio 8\VC>regasm asseblyname.dll /tlb

If someone knows the actual cause please let me know