How to determine database type for a given JDBC connection?

前端 未结 2 347
刺人心
刺人心 2021-02-01 14:58

I need to handle resultsets returning stored procedures/functions for three databases (Oracle, sybase, MS-Server). The procedures/functions are generally the same but the call i

2条回答
  •  清歌不尽
    2021-02-01 15:28

    I suspect you would want to use the DatabaseMetaData class. Most likely DatabaseMetaData.getDatabaseProductName would be sufficient, though you may also want to use the getDatabaseProductVersion method if you have code that depends on the particular version of the particular database you're working with.

提交回复
热议问题