0

i was wondering, why does it have to be so complex to develop a swing application that works with a DBMS on java?

I would expect it to be as simple as it is to develop an android app with DBMS, which is pretty much straight forward with the android.database.sqlite package...

Specifically, i would like to know why would it make you connect to the DBMS with URL's and have to install so many background complicated things just to get it to start working?

and do you guys know of a java package that works similiar to the android package for DBMS? or is there a way to include this package and work with it in a regular java project?

Ofek Ron
  • 8,354
  • 13
  • 55
  • 103
  • You're referring to Android's use of the SQLite package. You could also use SQLite from your Java apps. – wkl Oct 13 '12 at 14:42
  • Refer to a previous question about this: http://stackoverflow.com/questions/41233/java-and-sqlite or http://www.ch-werner.de/javasqlite/ or http://code.google.com/p/sqlite4java/ – wkl Oct 13 '12 at 14:45
  • Using JDBC with Java you can interface easily with several different databases - MySQL, H2, Derby, etc. Have a look at the Oracle java tutorials – CocoNess Oct 13 '12 at 14:47
  • @TanjaV i had looked at it, and it seem far too complicated compared to android's dbms package – Ofek Ron Oct 13 '12 at 14:48

2 Answers2

1

I think you question is too generic.
You can use SQLite in Java SE/Java EE in various ways.
For example - have you taken a look here? You should understand that the standard way to access relational DB is via JDBC.
Jdbc provides you an abstraction API for database access, and since it supports many DB vendors,
It has for example to support loading the property JDBC driver, which provides a vendor-specific implementation for the DB vendor in use (for example - mysql and oracle DB have different JDBC drivers).
As far as I know, this is not the case with Android -
which currently has a single "DB provider" -
SQLite, so in case of Android development you can skip the "Vendor driver loading" as you have one vendor.

However, there are various frameworks that allow you to simplify the work with relational database, such as spring-jdbc.

Yair Zaslavsky
  • 4,091
  • 4
  • 20
  • 27
  • These are all 3rd party packages, in android the support for a SQLlite DB is one of its core built in packages – Ofek Ron Oct 13 '12 at 14:46
  • The JDBC API was developed by Sun and other partners supporting the Java development. You will see this case happens quite frequently in Java - there is an API defined by Sun/Oracle and partners, and various implementations, so there should be a mean to configure which vendor to use. It's true that in many times Sun/Oracle provide a "reference implementation" but in the case of JDBC - it was defined prior to the purchase of MySQL by sun, so this is why they didn't provide an implementation on some DB, as they did not have a favorite one. – Yair Zaslavsky Oct 13 '12 at 14:50
1

Your java program is possibly going to run on a windows, linux, apple (or other) box. It has the ability to connect to mysql, postgresql, sql server, oracle or sqllite. It needs to be able to connect under all those operating systems potentially to all those databases. This flexibility comes at a cost.

Your android app is going to run on the android os with the sqllite database. This can be baked into the os, making life easy for you. But that app won't run on iOS or WinPhone.

mcalex
  • 6,628
  • 5
  • 50
  • 80
  • Exactly. You have that choice. Think of it from the point of view of the writers of java vs the writers of android – mcalex Oct 13 '12 at 15:07