JDBC文档中getDriverProperties方法描述是否长期存在错误?
DriverPropertyInfo Javadoc里的getDriverProperties方法错误 Great catch! You’ve stumbled on a long-standing documentation bug in JDBC that’s been around almost since the beginning—and yeah, it even made its way into Android’s JDBC-related classes too.
Let’s break this down clearly:
- The actual, correct method defined in the JDBC spec is
java.sql.Driver.getPropertyInfo(String url, Properties info). This is the method that returns an array ofDriverPropertyInfoobjects, built specifically for advanced developers to discover and supply connection properties when interacting with a Driver. - The mention of
getDriverPropertiesin theDriverPropertyInfoJavadoc is pure documentation error. This typo dates all the way back to early JDBC 1.0 days, and for whatever reason—oversight, legacy documentation carryover, or just not prioritizing a small text fix—it’s never been corrected through subsequent JDBC versions (2.0, 3.0, 4.x, etc.). - Android’s JDBC implementation inherited this mistake because it was built based on early JDBC specifications and their accompanying documentation. So the same incorrect reference shows up there too.
The good news is this is just a docs bug, not an API issue. Every legitimate JDBC driver (MySQL, PostgreSQL, etc.) correctly implements getPropertyInfo, and there’s never been a getDriverProperties method in the actual Driver interface. It’s just a copy-paste or naming mix-up that stuck around way longer than it should have.
Quick sanity check: If you look at the source code for any standard
Driverimplementation or the JDBC spec itself, you’ll never find agetDriverPropertiesmethod defined—confirming this is 100% a documentation error.
内容的提问来源于stack exchange,提问作者datafiddler

