Thursday, September 29, 2016

Windows Server 2016 RTM Released!

In case you haven't already heard the news, Windows Server 2016 was released!

Even though you cannot yet download it from MSDN, you can download a 180-day evaluation version from here and try it out for yourself: https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2016

Tuesday, September 27, 2016

Oracle Database Connection String for ODP.NET using TNSNames.ora

If you are using the TNSNames.ora file for connecting to your Oracle database, you might be a bit confused about using the following Oracle connection string as listed here: https://www.connectionstrings.com/oracle/


Normally, when you see something like that, you think immediately of setting up a DSN in ODBC Data Sources, right? Well, in this case, you do not need to set up anything in ODBC Data Sources! You simply configure your Net Service Name in your Oracle Client so that you have one or more entries in your tnsnames.ora file as follows:


Now, the Data Source attribute in your Oracle connection string simply corresponds to one of the entries in your tnsnames.ora file (in this case, there are entries for ORCL11G and ORCL respectively).

That is all there is to understanding how to build your Oracle database connection strings using TNS Names!

Oracle Database Connection String for ODP.NET without TNSNames.ora file

I was recently attempting to follow the Oracle database connection string listed on https://www.connectionstrings.com/oracle/ using the ODP.NET Data Provider in order to establish a database connection to my Oracle 11g server, but I was soon faced with this error message:

ORA-12514: TNS: listener does not currently know of service requested in connect descriptor



I couldn't figure out the cause of this problem, since this same connection information is listed in the Oracle documentation (under the section for "Specifying the Data Source Attribute")!  https://docs.oracle.com/html/E10927_01/featConnecting.htm

Fortunately, one of my co-workers suggested using the following alternative connection string by replacing SERVICE_NAME with SID:


Making this simple change resolved my connectivity issues!

Using ASP.NET MVC Futures to eliminate Magic Strings

If you have used RedirectToAction throughout your ASP.NET MVC Controllers, you have probably experienced the frustration of having to manually type in string names of controllers as follows:


However, with ASP.NET MVC Futures, you can eliminate typing in these "Magic Strings" for these Redirects and instead rely on strong typing and using lambda expressions!

In order to get started, you first have to install Microsoft.AspNet.Mvc.Futures as a NuGet package:




Once you have installed this NuGet package, you will end up with a reference to "Microsoft.Web.Mvc".  You will have to add a using statement for this library to the top of your MVC Controller file.

Once you have done that, you can easily replace this RedirectToAction functionality in your Controller methods as follows:



That is all there is to cleaning up numerous "Magic Strings" from your ASP.NET MVC Web Application!

Installing Telnet Client from PowerShell

If you need to install the Telnet Client, you can either install it from using the Server Manager GUI or you can install it directly from PowerShell!

I, personally prefer PowerShell since it is much quicker than going through the wizards in Server Manager.

If you want to install Telnet Client from ANY client OS or server OS, you can run the following command:


However, if you wish to install PowerShell on a server OS, you can run the following command:

Monday, September 26, 2016

Where are the 32-bit Oracle ODBC Drivers?

If you are working with a 64-bit OS, you will encounter a problem which was not typically faced in the days of 32-bit OSes--namely, that you will have a separate set of 64-bit ODBC Drivers vs. a set of 32-bit ODBC Drivers.

So, when you type odbcad32.exe at the Run Command, you are ACTUALLY opening up the 64-bit ODBC Drivers that have been installed on the machine and NOT the 32-bit ODBC Drivers.

The 32-bit drivers can actually be found by typing the following path at the Run Command: \windows\SysWOW64\odbcad32.exe.  Therefore, if you are looking for the 32-bit Oracle drivers, you will only find these ODBC Drivers available in the 32-bit ODBC Drivers area.

When you open the ODBC Dialogs as well, you should look closely at the Title of the Dialog as well:



When you open the default ODBC Dialog, you will see a title of "ODBC Data Source Administrator (64-bit)".

However, when you open the 32-bit ODBC Dialog, you will see the following title instead: "ODBC Data Source Administrator (32-bit)"


If the titles match up, then you know you are in the correct place!!

Installing Oracle Client 12c on Windows 10

If you need to work with Oracle on your development machine, at some point in time, you are going to need to install the Oracle client on your machine.

Fortunately, if you install newer versions of Oracle clients, they will usually remain backwards-compatible with older versions of Oracle server.  For example, you can STILL install and Oracle 12c client while working with an Oracle 11g R2 database!

Without further ado, below you can find the steps to install Oracle Client 12c on your Windows 10 system:











For whatever reason, Oracle does not ship with necessary Visual C++ Prerequisites with its installer, so you will have to also separately install the Visual C++ Redistributable.

Otherwise, you may end up with errors such as the following when attempting to set up your ODBC DSNs for Oracle:



Based on the Oracle Pre-installation requirements, you can install a number of Visual C++ installers on your system ranging from Visual C++ 2010, to 2012 to Visual C++ 2013: http://docs.oracle.com/database/121/NTCLI/pre_install.htm#NTCLI1257

However, in my experience, the ONLY version of Visual C++ I was able to get to work on my machine was Visual C++ 2010 which you can download from here: https://www.microsoft.com/en-us/download/details.aspx?id=5555


NOTE: If you are installing the 32-bit Oracle Client, then you will need to install the Visual C++ x86 installation and likewise if you are installing the 64-bit Oracle Client, you will need to install the Visual C++ x64 installation.