开发者

Programming for various database

I'm wondering for those enterprise programs, how do they link to various type of database just by stating the connection string?

Issues like different syntax, variable type will definitely be there.

Apart from stored procedures for each type of开发者_开发百科 database, how else do they handle in terms of their programming?

1 way that came to my mind is just if else checking of database in order to populate different query.

Asking as I'm curious while using a engine which is built in C++ and jsp, but could support SQL Server, Access, MySQL, Oracle


ORMs tackle this problem by introducing a level of abstraction between the database and the domain model. For example with Hibernate you change the connection string and the dialect and HQL queries and Criteria APIs are automatically translated into the proper SQL for the target database.

Of course this assumes you never write a single line of SQL in your application or anything which is specific to the database.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜