I use java and jaybird driver. In my previous version with jaybird 2.x I used GDS low level access (Services API) to connect the server (without db-part in connection), to get the server version string.
Now I try to use FB3 + jaybird3beta. There are no GDS API in JB3. As I see from docs - there are org.firebirdsql.util.FirebirdSupportInfo object with 3 implementation
static FirebirdSupportInfo supportInfoFor(Connection connection)
static FirebirdSupportInfo supportInfoFor(FbDatabase database)
static FirebirdSupportInfo supportInfoFor(GDSServerVersion serverVersion)
As I see:
there are also java.sql.DriverManager with getConnection() function that " Attempts to establish a connection to the given database URL"
So, as I understand it s unable to get server version without connection to any database? Or I miss something?
Or how can I get the version of server using only server:port and given username/password?
Contrary to an earlier version of this answer, it is already possible (I had forgotten about it). To get the server version you can use the org.firebirdsql.management.FBServiceManager
class:
FBServiceManager manager = new FBServiceManager();
manager.setHost("localhost");
manager.setUser("sysdba");
manager.setPassword("your password");
System.out.println(manager.getServerVersion());
This method is currently not exposed in the interface definition ServiceManager
, I have created ticket JDBC-484 to address this for Jaybird 3.0.0 final.
As an aside: the class org.firebirdsql.util.FirebirdSupportInfo
was primarily written to simplify testing in Jaybird itself for tests that depend on features introduced in different Firebird versions. We included it in the distribution package because it might be useful to others. Just keep in mind that the results of the feature check methods do not necessarily mean that such a feature is available to a specific database, as sometimes features also require a specific ODS (On-Disk Structure) version of the database file.
Disclosure: I am a developer of Jaybird.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With