I hate databases...

Maximilian

Lifer
Feb 8, 2004
12,604
15
81
Ever since i stared my computing degree OOP has seemed awesome overall, most things made sense, everything seems logical, well thought out. Ive been touching on databases for a while now and had a slog through an EJB application involving a database... ffs how does a bunch of tables become this complex so quickly? You need to have the database driver, the code needs annotation, there's something about persistence states as well and a bunch of other stuff ive probably forgotten about. SQL as well... its not bad but its kind of a mess, you need to stick this stuff in as a string? So then the IDE wont tell me if ive ballsed up and made nonsensical query... I dunno maybe there's SQL tools out there i haven't heard of. Oh and its not classes anymore its entities and beans and session beans and stateless beans and stateful beans but these are all actually classes or something?.... Getting my head around this thing is a nightmare.

And this is just Java's way of doing it. God knows how C# or other languages work with databases or enterprise stuff. I had a brief encounter with a VB.net database, i remember binding sources and buggering it up and not being able to make it work again, ctrl-z failed me so yeah lol didn't get far with that! Bollocks to working with this stuff 10-15 years ago when i gather there was no JDBC/standardization.

Is it just me or are databases a complicated messy thing to grasp? o_O

cliffs:
- Don't like databases
- Very complicated
- Do i just suck?
 

ringtail

Golden Member
Mar 10, 2012
1,030
34
91
http://www.arachnoid.com/MySQL/index.html

http://www.arachnoid.com/MySQL/relational_databases.html

replying to your, "...maybe there's SQL tools out there ...", suggest you don't place hope in finding some tools that'll be your answer.

It comes down to simple methodical studying. Unfortunately some authors use terminology that's best avoided at the beginner's level. Better to browse a bookstore for a "Intro to databases" book by some author who writes in a style that accords well with you personally, so that it goes down easy.

Then just step your way through it.
Start today, June 19, and you'll attain your pollywog badge by July 1, and you'll be a big daddy bullfrog of databases by July 31.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
I don't find databases to be complex, necessarily. Much of what you mentioned is in the interface between the DB and the language you're using, not in the database tier itself. At their core relational databases are a fairly simple concept. The layers of complexity come in when we want our tools to design and implement the table structure, create the entity mappings, generate code to access data, set up and maintain connection state, etc.
 
Nov 7, 2000
16,403
3
81
most db's are designed smartly, but your complaints dont seem to be DB related, moreso DB/code interface
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
I do wish I had an IDE for PHP that would at least do lint-style sanity checking of my MySQL queries.

I spend most of my time writing C++ in Visual Studio, so when I switch to PHP + MySQL the IDE downgrade is painful.

I have no complaint about relational databases themselves though, just my current set of tools.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
I do wish I had an IDE for PHP that would at least do lint-style sanity checking of my MySQL queries.

I spend most of my time writing C++ in Visual Studio, so when I switch to PHP + MySQL the IDE downgrade is painful.

I have no complaint about relational databases themselves though, just my current set of tools.

I bet vim can do it :p
 

tfinch2

Lifer
Feb 3, 2004
22,114
1
0
I like using jooq to write typesafe queries in Java to get compile time checks. It will also generate you model classes from your DB schema.

I've also used Spring JDBC Template. I found it easy to use, but it always seemed like I was writing a lot of boilerplate code.

I also like Jongo for MongoDB.
 

Jaydip

Diamond Member
Mar 29, 2010
3,691
21
81
Ever since i stared my computing degree OOP has seemed awesome overall, most things made sense, everything seems logical, well thought out. Ive been touching on databases for a while now and had a slog through an EJB application involving a database... ffs how does a bunch of tables become this complex so quickly? You need to have the database driver, the code needs annotation, there's something about persistence states as well and a bunch of other stuff ive probably forgotten about. SQL as well... its not bad but its kind of a mess, you need to stick this stuff in as a string? So then the IDE wont tell me if ive ballsed up and made nonsensical query... I dunno maybe there's SQL tools out there i haven't heard of. Oh and its not classes anymore its entities and beans and session beans and stateless beans and stateful beans but these are all actually classes or something?.... Getting my head around this thing is a nightmare.

And this is just Java's way of doing it. God knows how C# or other languages work with databases or enterprise stuff. I had a brief encounter with a VB.net database, i remember binding sources and buggering it up and not being able to make it work again, ctrl-z failed me so yeah lol didn't get far with that! Bollocks to working with this stuff 10-15 years ago when i gather there was no JDBC/standardization.

Is it just me or are databases a complicated messy thing to grasp? o_O

cliffs:
- Don't like databases
- Very complicated
- Do i just suck?

Actually I like the way .net in particular handles databases.
 

beginner99

Diamond Member
Jun 2, 2009
5,314
1,756
136
Well Enterprise Java is pretty complex. There is just soooo many stuff you need to know...in fact it nearly impossible to be good at everything meaning database, messaging, threading, knowing application servers, JTA, JPA, JAXB,... and so forth.

The problem you mention here is well known:

http://en.wikipedia.org/wiki/Object-relational_impedance_mismatch

If you don't need the extreme ultimate performance you will need to use an ORM like hibernate, EclpiseLink, OpenJPA,...

In terms of type-safe and correct querries please see:

http://www.querydsl.com/

Pretty great. And even better you can combine it with Spring data:

http://www.springsource.org/spring-data/jpa

So an ORM + Spring Data JPA + QueryDSL makes it a lot easier to deal with this issue. Note that Spring Data also exists for NoSQL stores and they can be both used in the same application. An example would be for neo4j, a graph-database.

http://www.springsource.org/spring-data/neo4j

Such a graph database can be much better for certain scenarios, eg. like "social graphs" where a relational database just plain sucks.
 

Broheim

Diamond Member
Feb 17, 2011
4,587
3
81
Actually I like the way .net in particular handles databases.

yeah, I have absolutely no problem with C# and databases, very uncomplicated.

honestly OP, JavaEE seems to be your problem, I've come to loathe java and the whole beans crap annoy the living daylight out of me (I will never ever touch JSF again).

sigh, if you don't like interacting with the DB yourself you could give JPA a try, I personally think it's a PITA but I guess some people must like it.
 

BrightCandle

Diamond Member
Mar 15, 2007
4,762
0
76
The database impedance mismatch is especially painful in Java EE. But that is more a factor of how EE chooses to map onto the database its objects. There are genuine issues with crossing the bridge from relational to OO and the default Java way of doing it is kind of bad.

There are some decent libraries in Scala for example that access databases in a far more sensible way, deal with some of the complexities a little better and better mapping libraries in Java than the hibernate approach. In my experience its better to avoid using OO mappers if possible and instead work on something a little lower level to use the database in the way its good.

There are of course pure OO storage mechanisms now so if using a relational database isn't necessary you can use something else.
 

beginner99

Diamond Member
Jun 2, 2009
5,314
1,756
136
yeah, I have absolutely no problem with C# and databases, very uncomplicated.

honestly OP, JavaEE seems to be your problem, I've come to loathe java and the whole beans crap annoy the living daylight out of me (I will never ever touch JSF again).

sigh, if you don't like interacting with the DB yourself you could give JPA a try, I personally think it's a PITA but I guess some people must like it.

Of course you need to learn JPA like everything else but you do it once. And with additional help like from Spring Data you can create a DAL with custom query support very, very quickly. Of course JPA (hibernate) have a certain performance penalty compared to pure JDBC but for most apps that is perfectly fine because what matters is rapid application development and easy maintenance. Most applications mostly idle, lets be honest.

Whats the equivalent of JPA in .net? AFAIK ADO.net is just as annoying and cumbersome as JDBC.
 

smackababy

Lifer
Oct 30, 2008
27,024
79
86
It seems like JDBC and even JPA to an extent are intentionally obtuse. At least, that was my impression when I first started. Once you understand it though, it isn't that bad. The boilerplate code is really the only thing that ends up being annoying, but hibernate eliminates that. I assume most languages suffer from that though, not just Java.

I haven't done any development interacting with a database with anything but JEE.
 

Graze

Senior member
Nov 27, 2012
468
1
0
Ever since i stared my computing degree OOP has seemed awesome overall, most things made sense, everything seems logical, well thought out. Ive been touching on databases for a while now and had a slog through an EJB application involving a database... ffs how does a bunch of tables become this complex so quickly? You need to have the database driver, the code needs annotation, there's something about persistence states as well and a bunch of other stuff ive probably forgotten about. SQL as well... its not bad but its kind of a mess, you need to stick this stuff in as a string? So then the IDE wont tell me if ive ballsed up and made nonsensical query... I dunno maybe there's SQL tools out there i haven't heard of. Oh and its not classes anymore its entities and beans and session beans and stateless beans and stateful beans but these are all actually classes or something?.... Getting my head around this thing is a nightmare.

And this is just Java's way of doing it. God knows how C# or other languages work with databases or enterprise stuff. I had a brief encounter with a VB.net database, i remember binding sources and buggering it up and not being able to make it work again, ctrl-z failed me so yeah lol didn't get far with that! Bollocks to working with this stuff 10-15 years ago when i gather there was no JDBC/standardization.

Is it just me or are databases a complicated messy thing to grasp? o_O

cliffs:
- Don't like databases
- Very complicated
- Do i just suck?


C# is simply beautiful to work in with databases. Using an ORM, entity framework makes my life so easy.
In php I don't use an ORM and do the good only SQL statements and binding.
I don't really see what this issue is. You simply need a better grasp of SQL I guess
 

AyashiKaibutsu

Diamond Member
Jan 24, 2004
9,306
4
81
I hate java. <3 C# it took all the good concepts of java implemented them better and more accessibly. All the work I've done has pretty much been interfacing websites with databases in java (with spring) or c# and it's not that bad once you get used to it. Really just boils down to implementing the database classes and then calling the right functions like everything else : p
 
Aug 26, 2004
14,685
1
76
You aren't composing dynamic SQL in code, right? That's not a good idea...

Use stored procedures, pass values derived in code.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
SPs IMHO should only be used in very special cases. logic belongs into code.

Stored procedures aren't necessarily for logic. Just as there is no reason for the database to handle business logic, there is no reason for the middle tier to know how the database is structured. Stored procedures are a robust and high-performance way to encapsulate the physical structure of the DB.
 

Graze

Senior member
Nov 27, 2012
468
1
0
You aren't composing dynamic SQL in code, right? That's not a good idea...

Use stored procedures, pass values derived in code.


Wat? My blood boils when people mention anything stored procedure related. The bloody shit people do in stored procedures!
 
Last edited:

Leros

Lifer
Jul 11, 2004
21,867
7
81
Stored procedures aren't necessarily for logic. Just as there is no reason for the database to handle business logic, there is no reason for the middle tier to know how the database is structured. Stored procedures are a robust and high-performance way to encapsulate the physical structure of the DB.

How do you handle managing stored procedures between different environments? How does a new developer setup their local environment? From a development and operations standpoint, it seems like stored procedures is going to cause headaches.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
How do you handle managing stored procedures between different environments? How does a new developer setup their local environment? From a development and operations standpoint, it seems like stored procedures is going to cause headaches.

At least with mysql you can use mysqldump to generate an SQL file that can recreate all your stored procs/functions. There's no reason that can't be included with the schema.sql file that the developer should be using to setup their local workstation.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
How do you handle managing stored procedures between different environments? How does a new developer setup their local environment? From a development and operations standpoint, it seems like stored procedures is going to cause headaches.

What Crusty said, and in general stored procs are part of the database schema, and get controlled as such. There are version control issues, and cross-platform issues, but since these are also shared with pretty much everything else in the schema it doesn't bother me that much. Certainly it doesn't bother me as much as having the database access layer in the middle tier know that, for example, a Company object has to come from three tables called Company, Offices, and Employees.