문제

I need to implement different logic for different databases (because DB2 and Mssql does not support regexp). How can I determine database vendor? (config file is not an option) I use Java.

도움이 되었습니까?

해결책

You can use DatabaseMetaData.getDatabaseProductName as this is implemented by driver vendors.It will give you all the information you need.

다른 팁

Take a look at DbDictionaryFactory. calculateDBDictionary(...) from open-jpa.

This utility attempts to determine the database by url and driver class and will return an appropriate DBDictionary (eg OracleDictionary or MySQLDictionary).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top