Wednesday, December 10, 2008

Oracle TimesTen 7.0 - installation and .NET experience. Part 1.

Finally back to looking into new products. This time Oracle TimesTen In-Memory database - http://www.oracle.com/technology/products/timesten/index.html.

Target for my installation is Windows 2008 x64 on AMD Turion X2.

Installation of both the IMDB and oracle sql developer was fast and straight forward. Although sql developer denied to cooperate with Timesten, giving the following error:

Caused by: java.sql.SQLException: Problems with loading native library/missing methods: ...\tt70_64\bin\ttJdbc70.dll: %1 is not a valid Win32 application ...

It looks like either I had non x64 jre installed and I didn't really looked if sql developer was x64 when I downloaded it. Subject to check asap.

Anyway after installation of jre 6.0 x64, problem with sql developer persists.
[Update 16-Dec-2008] This was solved by using a bat file from http://www.vermontinternetdesign.com/index.php?topic=439.5;wap2 (*contents also provided at the end of this entry, contrary to oracle timesten wiki I lacked the .bat in my installation)

Demos provided by Oracle work ok, so I progressed with no delay with trying to connect from .NET code.

There are 4 options I've identified so far:

1. Commercial ADO.NET provider from tankardsoft: http://tankardsoft.com/default.aspx
2. GNU licensed opensource project: http://sourceforge.net/projects/ttprovider

3. System.Data.Odbc: That is the least resistance path I took for today.
4. Write own wrapper.

The dummy code I wrote for today was:

using System;
using System.Data.Odbc;

namespace OdbcConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {

                using (OdbcConnection connection = new OdbcConnection("dsn=tttest"))
                {
                    connection.Open();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            Console.WriteLine("Press any key to exit");
            Console.Read();
        }
    }
}

Series of exceptions I went through:

System.Data.Odbc.OdbcException: ERROR [08001] [TimesTen][TimesTen 7.0.5.0.0 ODBC
Driver][TimesTen]TT0715: Unable to access log directory 'c:\tt\log'. OS-detecte
d error: The system cannot find the path specified. -- file "db.c", lineno 9104,
procedure "sbDbConnect"
ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the ve
rsion of ODBC behavior that the application requested (see SQLSetEnvAttr).
   at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode r
etcode)

This one pointing into the need to create the folder I provided as a log folder when creating a User DSN for the Timesten.

Then:

Driver][TimesTen]TT12701: DatabaseCharacterSet attribute required for data stor
e creation. Refer to the TimesTen documentation for information on selecting a c
haracter set. -- file "db.c", lineno 7403, procedure "sbDbCreate"

To solve this one I setup the character set to be UTF8 in my case (will be interesting to see how this is going to live with default .NET utf-16, will see soon.)

Here is how my data source configuration looked like:

image

Finally, my connect succeeded (although it looked that it took quite a second to connect), and this is it for today.

Overall, very positive experience for the first two hours. Was quite easy to troubleshoot and move forward given detailed and helpful error messages provided so far.

Next:

1. Resolve sql developer issues.
2. More research for the odbc option.
3. Create some data structures in the imdb.
4. Explore the performance of odbc (if odbc works at all at point #2) and compare with techniques of C++ wrapping.
5. See if http://blogs.msdn.com/vcblog/archive/2008/12/08/inheriting-from-a-native-c-class-in-c.aspx would be a viable wrapping technique (just out of curiosity).
6. Read, read and read ... :)


* The contents of a batch file to run sqldeveloper with explicitly stated jre is:

"C:\Program Files\Java\jre6\bin\java" -Xmx512M -Xverify:none -XX:JavaPriority10_To_OSPriority=10 -XX:JavaPriority9_To_OSPriority=9 -Doracle.ide.util.AddinPolicyUtils.OVERRIDE_FLAG=true -Dsun.java2d.ddoffscreen=false -Dwindows.shell.font.languages= -Dide.conf="sqldeveloper.conf" -Dide.home.dir.name=.sqldeveloper -classpath ..\..\ide\lib\ide-boot.jar;..\..\jdev\lib\xmleditor.jar;..\..\ide\lib\oicons.jar;..\..\jdbc\lib\ojdbc14.jar;..\..\jlib\jewt4.jar;..\..\jlib\share.jar;..\..\sqldeveloper\lib\jle2.jar oracle.ide.boot.Launcher

pause

Change the path to jre to be specific to your installation. Connection details for my case:

image

No comments: