Category Archives: Database

JDBC parameter for null timestamps in MySQL

I just came to know that support for timestamps with null values in MySQL JDBC using mysql-connector-java is not default! It throws an exception. However, using zeroDateTimeBehavior parameter with a value of convertToNull in the jdbc url will do the trick.

Leave a comment

Filed under Database, JDBC, MySQL

Rules Engine or Scripting Engine?

The question is which approach is better? The initial thought/requirement is that business users should be able to quickly adopt to changes in business and so, the rules engine provides them an easy way to quickly modify the business logic. But if only the business logic is so simple that one can simply change from + to – (markup vs discount). Those simple if then else rules soon become complex statements, blocks, built-in functions and soon a whole set of new language emerges and no longer in the reach of the business user to write them.

Perhaps when the scripting was not popular/well explored and thanks to the hype of AI in the earlier decades, the concept of rules engine came into existence. But with a better undersanding of scripting languages and the ability make them co-exist with compiled languages (c + tcl, java + beanshell a few examples), are rules engines lucrative anymore?

Yes, I do understand there is farward chaining, backward chaining, hybrid chaining and all that stuff and for that there are languages such as Prolog and Lisp that are very good at. But, deductive reasoning shouldn’t be confused with much of the business rules. I mean, it’s not like much of the auto-insurance policy rules have to go through a 10-level deep tree with 1000s of nodes before finding a solution. Or is it? I could be wrong, but hope not. Otherwise, it will be hard for me to compare and get the best deal :). So, I am not talking about knowledge based expert system type of rules engines.

I think the main issue is, going with hard-coded logic, it’s possible to do very complicated and optimized logic. Going with simple rules engines that are easy enough for business users, a few simple cases, perhaps even 70% of cases can be solved. But what about the rest? It’s the in-between cases that cause the problem. So, going with business rules perhaps is going to leave a gap.

However, using an embedded scripting engine, it’s probably possible to address the needs of both simple and medium complex problems. Infact, it may be possible to solve even the most complex problems, albiet a little slower (performance and not coding).

Frankly, if someone is telling that a business guy would know to write excel type of functions and branching logic such as IF(a,b,c), and can’t understand if(a) then b else c; then there is something fundamentally wrong in that assumption. I think it’s not the simple syntax that is the problem, but the overall logic of the code that makes it difficult.
And especially, if the data for the logic is in the database, the seamless way of fetching the necessary data, the sqls, the transaction and commits, in memory data vs database data and so on. These are the things that make things more complex, and not the simple syntax of rules.

All said and done about rules, Oracle 10g has an interesting rules engine that is event based. Pretty cool stuff and has more practical use than what conventional rules engines or programs can offer.

Those interested in scripting languages can further explore with these scripting languages books.

Leave a comment

Filed under Database, Questions, rules engine, Scripting

A good jdbc based database explorer

I wanted to incorporate Derby into one of my projects and instead of using their ij command line tool, I wanted to use a UI to explore the objects and data. For this, I tried searching for a good tool.

I found this link on Oreilly

http://www.oreillynet.com/oracle/os_dir/gui.csp

But finally I settled with executequery

So far it’s been good experience using it. If you are new to jdbc, more can be learned from these jdbc books.

2 Comments

Filed under Database, JDBC