Reputation: 8903
Are there any other means of connecting java applications to DB other than JDBC? Like when we use Hibernate in our java apps, i believe Hibernate internally used JDBC mechanism to eventually connect to DB.
So my question is that is JDBC the way in which we connect to DB?
Thanks
Upvotes: 0
Views: 49
Reputation: 126
In my opinion, JDBC would be the first choice so really would not be seeking alternatives. That said, one could use the JDBC-ODBC bridge. Your app is still written to JDBC but the connection to the DB is with an ODBC driver. I would much prefer the fully Java approach of a JDBC driver. Depending on what database you want to access, they may have Java libraries that expose their native API and you could write to that. Bur, your code would be completely non portable to other database if you ever wanted to expand. A well written JDBC app should be able to access different databases simply by plugging in another JDBC driver and adding the appropriate connection information. Also, if you needed an assistance later on with JDBC being fairly widely used it will be easier to get than assistance than with a native solution.
I am left wondering why you're searching for alternatives to JDBC though.
Upvotes: 1
Reputation: 2774
JDBC is a standard all ORM tools need to follow while connecting to DB using Java
Upvotes: -1
Reputation: 36987
In general, JDBC is practically always used to connect to SQL databases, either directy or under the hood by an ORM. NoSQL-Databases use other APIs.
Upvotes: 3