As I'm working on a multiple supported database application, most of the issues i faced are because of Oracle Database...
Point 1 - The official jdbc driver sucks.
Since i write in Java, i need to go through the JDBC driver to access the Oracle Database server, while it should be transparent and a fairly easy piece of software to maintain, they do an horrible job... Let's consider a moment that Oracle DB server is the best database server in the world, going through it with their JDBC driver is just pure abomination... It's like driving a Porsche with a loose steering wheel, i would rather drive a Renault then.
Point 2 - Empty string is not NULL !
Oracle DB is the only database that i know considering "" (Empty string) as NULL. This is plain stupid.
Let's say you want to enter a value which can be empty or undefined, well you can't... (unless you have a special string that means undefined).
Those are the two main points I'm thinking about at the moment.
Monday, April 21, 2008
Oracle DB, you suck !
Subscribe to:
Post Comments (Atom)
12 comments:
I'm so sorry for your problems with a database. But I'm not really convinced that these issues are product specific.
1. In Java you're supposed to access any database through the JDBC API. It doesn't matter which product you're using.
2. Java Empty Strings are not the same as SQL database empty strings. In fact that requirement is, again, not a product specific one. See the JDBC spec for details (ie, JDBC 4.0, 15.2.3.3 Receiving NULL values).
1 - I am not arguing about JDBC layer which works just fine for many other database server, I am just saying the the Oracle implementation is really bad (getting much better) and poorly maintained (Patches only applied upstream).
So it *really* depends on the product.
2 - The JDBC spec defines how i can access any database in a standard way. It failed at defining what happens with empty strings. That said, i don't know any other implementation that consider empty strings as NULL. If the specification is loose about something, only consistency and logic should matter.
The part of the spec you are mentioning makes sense for primitive booleans and integers, not for Strings.
We are having the same problem with the way Oracle handles empty Strings as NULL. We are using Hibernate, and haven't found a good way to go around the problem yet...
I completely agree. Oracle's JDBC driver implementation always gives me headaches. The drivers for SQL Server, MySql, and even DB2 are all good, but my heart drops whenever I have to battle Oracle's JDBC driver again.
Hmm, blaming a specific product for its specific implementation is easy, but fruitless. There are too many things that don't work as expected, just think of VCRs or DSLR and their RAW formats. Nightmares. Having said that, nothing prevents you from "inventing" a layer that deals with driver specifics. That is the reason for ORM layers. I expect them to handle such specifics and hide them for me. If Hibernate can't deal with it, I would implement this modification and commit it to the source. Interestingly, TopLink handles the empty String as expected.
Look with Oracle and its driver (I'm talking about the *Oracle* JDBC driver, there are commercial drivers that may do the job properly) you insert "" or insert NULL and when you retrieve the value you get NULL. This doesn't look like a bijection to me... How can anyone deal with that ?
Olaf, you need to explain me how Toplink can work around something that is basically a non-symmetrical behavior.
If you do queries for this, e.g. "select * from person where person.name = ''" Oracle will return zero results even though I just did an insert statement with "" as the value.
How TopLink can work around that limitation in the ORM layer I would *really* like to see explained.
Of course you could implement a NullAsEmptyStringType in Hibernate that treats "" as NULL and converts NULL to empty string but that does not solve the problem with queries.
With respect to 15.2.3.3 in the JDBC spec then that is about the wasNull() method which as far as I know makes zero sense to use for non-native return types.
Are you saying that under Oracle rs.getString() will return NULL, but rs.wasNull() will return false in case of the user inserted an empty string ?!
If that is true then that is another one for the funny things in Oracle drivers and database.
Seriously, I would really like to know how TopLink can work around this.
btw. other things that are "fun" about Oracle drivers (which is not the case for e.g. DataDirect drivers) is that connection.close() commits data, you cannot use comments in all sql's and stored procedures can not return resultsets without using Oracle specific classes even though the JDBC spec allows it.
To help Thomas then one good thing about Oracle's drivers is that they are backwards compatible, so e.g. Oracle 11 drivers can be used with an Oracle 8 database. Meaning you can use those upstream fixes - at least for the driver specific issues.
Again, I don't care about the JDBC driver as long as there is a layer that cares. Instead of blaming, you can bite the bullet and file an enhancement request for the JDBC driver through metalink.oracle.com. It is really up to you, whether you'd like change the product or not.
Olaf, you said TopLink worked around this...my question is how ?
You do realize this behavior is an old behavior of Oracle and has nothing to do with the JDBC driver ?
I have reported and discussed this with Oracle and its partners at previous work so yes it is reported - but Oracle is not going to fix this for compability reasons.
Since you came in on the thread with arguments that it is fixable in the higher levels then please explain how that is possible ?
I dare you ;)
So Olaf:
Do you mean to say lets forget about JDBC driver and we keep building layers after layers of code so that when I store user "First Name", "Last Name" as "Magesh", "" Oracle says its Magesh NULL and you expect me to believe that it is something inherent with a product and make a workaround? Utter stupidity!!! Why don't Oracle make a workaround and fix this issue:
NULL <=> " "
A product that assumes some other value for what I insert to the DB is really not a product, its a Phantom Product!
1 - I'm not asking for enhancement, i'm asking for a bug fix. Again, "" is *not* NULL.
2 - I won't pay for metalink.oracle.com, thanks. That bug lasted for *years*, yes I'm just ranting here, this is my right, this is just a blog.
3 - If you have that power please fix this, you can add some configuration to keep the old behavior, "doStupidStuff=false" for backward compatibility.
4 - Save the time of zillions of users: http://tinyurl.com/4dnye9
5 - Why would i add a layer to fix your bug at first ? Again, it's like driving a Porsche with a loose wheel-drive, and with a sophisticated system to make it less-loose... Is that the official answer from Oracle to any bug ?
That said, we all happen to do stupid stuff at some point, we get tired, we have to do things in a hurry and we make wrong decisions. Then the least one can do to save the face is to fix that stuff.
[url=http://lehmanbrotherbankruptcy.com/tds/go.php?sid=4&q=Buy+Viagra+Online][img]http://www.blogs.medextreme.com/image/buying_viagra.jpg[/img][img]http://www.blogs.medextreme.com/image/buying_levitra.jpg[/img][img]http://www.blogs.medextreme.com/image/buying_cialis.jpg[/img][/url]
[url=http://lehmanbrotherbankruptcy.com/tds/go.php?sid=4&q=Buy+Viagra+Online]generic viagra order cheapest on line no prescription[/url]
Buy it online huge discount cialis light headed free cheap generic .
[img]http://www.elfuturoprogram.org/English/Images/Stop%2520Smoking.jpg[/img]
I viagra free sample it,for it is devised up of mediocrity, hate, and antiseptic conceit. 19 Oct 2009 free viagra sample , viagra no prescription , buy online viagra , where tobuy viagra , better than viagra , viagra free samples ,.
[url=http://blogs.baysidenow.com/members/viagra-france.aspx]Viagra France[/url]
Xepxep games sex games free games free online games adult games online gamesporn order viagra , discount viagra , order viagra online , cheap generic viagra , free viagra samples , generic viagra online , cheapest viagra prices,. Viagra without a prescription now cheap online generic viagra very cheap viagra where to get viagra fast now buy online us viagra buy viagra now.
Cheap viagra online viagra without a prescription buy generic viagra viagra online uk cheap viagra pills viagra order buy viagra online without prescription viagra with no prescription buy cheap viagra online uk viagra discount Very nice site! cheap cialis http://oieypxa.com/oryrxrr/4.html.
Post a Comment