Connecting to an Oracle database via ODBC using only the InstantClient

Until today, I thought to be able to connect to an Oracle database from your Windows machine, you need to install the complete Oracle client including the Enterprise Manager etc. (>1GB). However, today I finally found a way to use Oracle via ODBC using only the InstantClient (ca. 50MB) on the Oracle website:

  1. First of all, download the InstantClient and the corresponding ODBC drivers for your platform from Oracle’s download site.
  2. Extract the archives into a directory of your choice, e.g. D:\Dev\Oracle\instantclient_11_2 (from now on referred to as %INSTALLDIR%).
    Connect to Oracle via ODBC using the InstantClient (directory structure)
  3. Run odbc_install.exe in %INSTALLDIR%.
    Connect to Oracle via ODBC using the InstantClient (installing the ODBC driver)
  4. Create the directory %INSTALLDIR%\network\admin and place your tnsnames.ora file in that directory.
    Connect to Oracle via ODBC using the InstantClient (adding tnsnames.ora)
  5. Set the environment variable ORACLE_HOME to %INSTALLDIR%.
    Connect to Oracle via ODBC using the InstantClient (setting ORACLE_HOME)
  6. Configure a new ODBC data source using InstantClient.
    Connect to Oracle via ODBC using the InstantClient (creating an ODBC data source)

That’s it! Now you’ll be able to connect to your Oracle database via ODBC.

PowerShell: How to read contents from text files without converting the lines into an array

Apparently, PowerShell’s get-content cmdlet automatically converts the contents of text files into an array of strings, splitting the contents at the line breaks (see Using the Get-Content Cmdlet). In many cases this is convenient:

Contents of file test.txt:

gc text.txt | % { write-host „line: “ $_ }
line: 1
line: 2
line: 3

However, if you need the file’s contents as an unchanged string (e.g. to keep line breaks the way they are when working with Unix/Linux line endings) this is not what you want. In this case, you can use the .NET method File.ReadAllText() (see File.ReadAllText Method:


Stellenangebot: Softwareentwickler/in und Systemadministrator/in in Vechta gesucht

Mein Arbeitgeber, die ALTE OLDENBURGER AG, sucht zur Zeit mal wieder neue Kollegen/innen im EDV-Bereich:

Stellenangebote bei der ALTE OLDENBURGER AG.


Ihre Aufgaben

  • Neu- und Weiterentwicklung versicherungstechnischer Anwendungen
  • Plattformübergreifende Integration prozessunterstützender Anwendungssysteme
  • Wartung der betreuten Anwendungen und Beratung der Fachbereiche

Ihr Profil

  • Abgeschlossene Ausbildung zum Fachinformatiker Anwendungsentwicklung oder ein abgeschlossenes (FH-)Studium im Bereich (Wirtschafts-)Informatik oder Software-Engineering.
  • Idealerweise 2 Jahre Berufserfahrung in der Softwareentwicklung in mind. einer der Programmiersprachen Java, C# oder Natural.
  • Breites Interessenspektrum und die Bereitschaft zur selbstständigen Einarbeitung in verschiedene technologische Bereiche.


Ihre Aufgaben

  • Administration unserer Windows- und Linux-Netzwerkinfrastruktur
  • Betreuung unseres Dokumentenmanagementsystems
  • Administration unserer Citrix- und VMWare-Infrastruktur
  • Unterstützung bei Support und Dokumentation sowie Koordination verschiedener Dienstleister

Ihr Profil

  • Abgeschlossene Ausbildung zum Fachinformatiker Systemintegration oder ein abgeschlossenes (FH-)Studium der (Wirtschafts-)Informatik.
  • Idealerweise 2 Jahre Berufserfahrung in der (Netzwerk-)Administration von Linux- und Windows-Servern.
  • Optional Berufserfahrung in der Administration von Oracle-Datenbanken.
  • Breites Interessenspektrum und die Bereitschaft zur selbstständigen Einarbeitung in verschiedene technologische Bereiche.

Copying files larger than 2GB to a mounted Samba share on Linux

Today we had a problem copying a large file (>4GB) to a Samba share using Linux. The share was mounted via smbmount and worked perfectly for all other files. However, the large file was copied to the share only up to a size of 2GB and then the copying aborted.

The solution was to mount the share with the option lfs (apparently this is short for „large file system“), e.g. like this in /etc/fstab:

//server/share$ /local/path smbfs lfs,username=user,password=secret 0 0

FLOW3: Convert a date string from an input field of a view into a DateTime object

As I’ve mentioned earlier, the FLOW3 documentation is a bit weak at the moment. The initial example walks you through a very simple view where only strings (like „title“, „author“) are entered via the view’s form. But how do you enter a date and have it converted to a „real“ \DateTime upon initializing the object that should contain it?

I found the solution (again, mainly by chance) here: How to use the DateTimeConverter in FLOW3. Apparently, you have to convert the user’s input to the needed objects in a method in the corresponding controller, that is (magically?) called before the method that expects the main object you want to create (that contains the date).

Here’s an example: If you have a Report object that has a dueDate attribute of type \DateTime, you have to convert the user input (a string) to a \DateTime object in the method initializeCreateAction() of class ReportController.

FLOW3 offers quite a few type converters, among which you can also find a DateTimeConverter. You can use it like this in initializeCreateAction():

  1. public function createAction(Report $report) { }
  3. public function initializeCreateAction() {
  4.   $this->arguments[‚report‘]
  5.     ->getPropertyMappingConfiguration()
  6.     ->forProperty(‚dueDate‘)
  7.     ->setTypeConverterOption(
  8.       ‚TYPO3\FLOW3\Property\TypeConverter\DateTimeConverter‘,
  9.       \TYPO3\FLOW3\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT,
  10.       ‚Y-m-d‘);
  11. }

FLOW3 now converts the input string (format ‚Y-m-d‘) into a „real“ \DateTime object before passing it on to the newly created Report object, that gets passed to createAction().

L4N (Log4Nat) – a logging framework for Natural (by Software AG)

Along with NatUnit (a unit testing framework) we released L4N (or Log4Nat, or Log4Natural ;-)) on SourceForge today: L4N on SourceForge.

L4N offers basic logging functionality for Natural (by Software AG), including:

  • user- and module-specific logging
  • different log levels (e.g. debug, info, error)
  • combinable logging facilities (e.g. work file, INPUT, WRITE, database)

Using the framework is easy, as the following code shows:

  1. LOCAL USING L4NCONST /* some constants like log levels etc.
  2. LOCAL USING L4NPARAM /* the parameters (e.g. log text) for calling the actual logging
  3. * (optional) basic configuration of logging for the current module
  4. L4N-DEBUGUSER := ‚macke‘
  8. * the actual logging
  9. COMPRESS ‚Current value:‘ #VALUE INTO L4N-LOGTEXT

L4N is licensed under LGPL v3, so feel free to use it in your (commercial) applications or even help us further develop the framework.

NatUnit (former NUNIT) on SourceForge

We published NatUnit (former NUNIT) on SourceForge today: NatUnit on SourceForge.

Due to naming conflicts with the „real“ NUnit, we decided to publish it as NatUnit. However, the internal name is still NUNIT, as Natural module names are restricted to a length of 8 characters which left us with only one character to distinguish between modules, if we used NATUNIT 😉

NatUnit is easy to use, as the following code (a simple test case) shows. The whole framework is written in Natural itself, so you don’t have to use external tools like NaturalONE.

  6. *
  7. NUTESTP.FIXTURE := ‚Example TestCase 1‘
  8. *
  11. *
  13. *
  14. ********************************************************************************
  15. IF NUTESTP.TEST EQ ‚compare two equal numbers should pass‘
  16. ********************************************************************************
  18. END-IF
  19. *
  21. *
  22. END

NatUnit is licensed under LGPL v3, so feel free to use it in your (commercial) applications or even help us further develop the framework.

FLOW3: Create a select box mapping to a list of objects in a Fluid view

FLOW3 rocks. However, the current documentation is… well… a bit short 🙂 The quickstart guide and the blog example show you the basics of working with FLOW3 and Fluid, its templating engine. But for explanations or examples of even the slightest more complex functionality you have to search the web for quite some time (or at least I had to ;-)).

Like today: I wanted to map an object of type Invoice to an object of type Client in a Fluid view. How do you do that, so that FLOW3 instantiates a real Client object and hands it over to the Invoice object upon its instantiation? It turns out, all you have to provide the framework to magically do that, is something like a select tag with the Client objects‘ GUIDs like this:

  1. <select name="client">
  2.   <option value="80f870ee-931c-4706-8716-fb3e52bbe450">Client 1</option>
  3.   <option value="fb2cd21e-64e8-439b-bff2-be51948b8ff5">Client 2</option>

But how do you do that using Fluid? I found the solution (mainly by chance) here: FLOW3 – your first relation between to models.

  1. < property="client" name="client" options="{clients}" optionLabelField="name" />

If you omit the attribute optionValueField on the view helper f:form (see Fluid ViewHelper Reference), the objects‘ GUIDs are magically used for the values of the options in the HTML form and FLOW3 figures out that it has to instantiate Client objects.

Iterate over a possibly empty array in VBA (Excel)

When you try to iterate over an empty array in VBA like this, you will get a runtime error (index out of bounds):

  1. Sub ArrayTest()
  3. Dim testarray() As Integer
  4. Dim i As Integer
  6. For i = LBound(testarray) To UBound(testarray) ‚ <– error
  7.    Debug.Print testarray(i)
  8. Next i
  10. End Sub

Even if you check the return value of LBounds like this, it results in the same error:

  1. Sub ArrayTest()
  3. Dim testarray() As Integer
  4. Dim i As Integer
  6. If LBound(testarray) > 1 Then  ‚ <– error
  7.    For i = LBound(testarray) To UBound(testarray)
  8.         Debug.Print testarray(i)
  9.     Next i
  10. End If
  12. End Sub

However, to get rid of the error and to iterate over a possibly empty array, the following code works:

  1. Sub ArrayTest()
  3. Dim testarray() As Integer
  4. Dim i As Integer
  6. On Error Resume Next
  7. If LBound(testarray) > 1 Then
  8.     If Err.Number = 0 Then
  9.         For i = LBound(testarray) To UBound(testarray)
  10.             Debug.Print testarray(i)
  11.         Next i
  12.     End If
  13. End If
  15. End Sub

Visual Basic magic 😉