nrdo-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nrdo-list] nrdo weekly news: 2003/10/10


From: Stuart Ballard
Subject: [nrdo-list] nrdo weekly news: 2003/10/10
Date: Fri, 10 Oct 2003 17:16:42 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030527 Debian/1.3.1-2

Welcome to the third edition of nrdo weekly news. Since the last issue was in May, you might think the title is something of a misnomer, but it's not: this was just a very *long* week ;)

In truth, for the majority of the time since the last edition there really wasn't anything much going on. The nrdo web site at nrdo.sab39.org went down, but this wasn't too much of a loss as there wasn't much there in the first place. A replacement will be hosted at Savannah as soon as I find the time to write one :)

Things first began to pick up again in the last month or so with the addition of the "existing" keyword in dfn files, allowing nrdo to generate source code corresponding to a table that already exists through some other means. In conjunction with "before" statements, this allows using nrdo with database Views and Oracle synonyms.

Michael Hitchcock resumed his project that uses nrdo with Microsoft Access with the discovery of a serious performance problem. The C# bindings created by nrdo were creating, opening and closing a brand new database connection for every single request. In our usual environment - Microsoft SQL Server - this doesn't appear to cause any problems, perhaps due to clever connection pooling in the driver. But with Access, the time to create all these connections was crippling. (Incidentally, the Java bindings avoid this problem by requiring a Connection to be passed to almost every single method - it works, but it's annoying).

Michael implemented a custom solution to his problem by creating a connection in the Global.asax of his web application, and modifying his copy of nrdo library to use that connection instead of creating a new one. Obviously this solution won't work for everyone: not every application is ASP.NET so there isn't always a Global.asax to use. Eventually, a general solution will be implemented in nrdo that will probably involve a ConnectionFactory class with multiple implementations. User code can set the ConnectionFactory to tell nrdo *how* to create a connection.

After much prolonged debugging I was finally able to identify why nrdo failed to work correctly on Free (open source) implementations of Java. The guilty code was the constructor of GNU Classpath's implementation of HashMap. Since this code is used unchanged by virtually every Free implementation, I saw the same problem everywhere. The problem was that in an attempt at optimization, Classpath's implementation calls size() and just loops that many times adding items, ignoring the hasNext() method which is supposed to indicate if any items are left. In most cases this "optimization" is harmless, but one of nrdo's data structures has no efficient way to get the correct value for size(), so it gives a "best guess" instead. Sun's JDK doesn't rely on size() being correct so it works fine; Classpath does, so it breaks.

A fix to this problem is under discussion on the Classpath list - apparently not everyone agrees that the current behavior is broken. The patch has already been accepted into Kaffe, however, and was included in the recent Kaffe 1.1.2 release. In the meantime, I've added a workaround to nrdo which bypasses the faulty code and does the work itself. With this change, nrdo works out-of-the-box on the current CVS version of Classpath (older versions may work too, but haven't been tested).

This leads to the big news of this edition: because nrdo now works out of the box with PostgreSQL and a Free implementation of Java, it meets the criteria set out by the Savannah hackers for uploading the source. So nrdo's source code is now available by anonymous CVS from Savannah, and can be browsed on the web from the "CVS" link on http://savannah.nongnu.org/projects/nrdo. I still haven't quite met all the criteria that I think are necessary for a public "release" - mostly documentation - but public anonymous CVS is a big step forward. I still haven't figured out how to get write access to the CVS, which is a problem, but I hope to sort that out soon.

Finally, in one of my other TODO items, I determined that nrdo does work correctly under IKVM.NET, making it possible to turn nrdo's Java source code into an exe file that runs under the .NET Framework. This is useful to people using nrdo's C# output as it reduces the number of dependencies necessary - you probably already have the .NET Framework installed, but you may not have a Java runtime.

The trick is to use ikvmc to compile nrdo's source code into an exe file, then use ikvmc on your database's JDBC driver to compile that into a DLL. This has been tested with Microsofts "SQL Server 2000 driver for JDBC" (yes, that's what they call it) and despite some scary looking error messages, it actually works just fine. In order for the ikvmc-compiled nrdo.exe to find the DLL, you need to change the "dbdriver" line of your config file to include ", dllname" at the end, where "dllname" is the name of the DLL you created.

That's all for now - see you next week (which hopefully will be a shorter period of time :) )

--
Stuart Ballard, Senior Web Developer
FASTNET - Web Solutions
(215) 283-2300, ext. 126
www.fast.net





reply via email to

[Prev in Thread] Current Thread [Next in Thread]