Search code examples
javajdbcglassfishdatasourceinformix

DataSource valid connection but getURL returns null?


I had this situation reported to me with Informix over Payara (Glassfish).

Is there any cases where we could get a valid connection but DatabaseMetaData getURL could return null?


Solution

  • If you create an Informix JDBC connection from a DataSource, then from the driver's perspective there is no URL, and DatabaseMetaData.getURL() will return null.

    If you make a connection using DriverManager and pass in a URL, then you should get that URL back from the metadata.

    One could argue that the connection could 'build' a URL from the DataSource to give back to you, but the Informix JDBC driver today does not do that.