[ 
https://issues.apache.org/jira/browse/DERBY-4961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12979399#action_12979399
 ] 

Knut Anders Hatlen commented on DERBY-4961:
-------------------------------------------

I don't think this is a bug. The API documentation at 
http://db.apache.org/derby/javadoc/publishedapi/jdbc4/org/apache/derby/tools/sysinfo.html#getMajorVersion()
 says that it should return the version number of the embedded driver:

public static int getMajorVersion()

    gets the major version of the Apache Derby embedded code.

    Returns:
        the major version. Returns -1 if not found.

So what you observe seems to be consistent with the documented behaviour.

The supported ways to get the version of the client driver are:

1) Use the getDriverMajorVersion() and getDriverMinorVersion() methods in 
java.sql.DatabaseMetaData.

2) Call the variants of sysinfo.getMajorVersion() and sysinfo.getMinorVersion() 
that take a String argument. The argument should be the value found in the 
constant sysinfo.CLIENT.

> org.apache.derby.tools.sysinfo return wrong minor & major versions if 
> ClientDriver is used
> ------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4961
>                 URL: https://issues.apache.org/jira/browse/DERBY-4961
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>    Affects Versions: 10.7.1.1
>            Reporter: Juraj Burian
>
> I am not sure that this is a bug.
> Hibernate uses code like this:
>                       final Class sysinfoClass = ReflectHelper.classForName( 
> "org.apache.derby.tools.sysinfo", this.getClass() );
>                       final Method majorVersionGetter = 
> sysinfoClass.getMethod( "getMajorVersion", ReflectHelper.NO_PARAM_SIGNATURE );
>                       final Method minorVersionGetter = 
> sysinfoClass.getMethod( "getMinorVersion", ReflectHelper.NO_PARAM_SIGNATURE );
>                       driverVersionMajor = ( (Integer) 
> majorVersionGetter.invoke( null, ReflectHelper.NO_PARAMS ) ).intValue();
>                       driverVersionMinor = ( (Integer) 
> minorVersionGetter.invoke( null, ReflectHelper.NO_PARAMS ) ).intValue();
> The problem is that if ClientDriver is used, this code returns -1, -1 instead 
> of correct version numbers. 
> Hibernate checks versions and if not correct numbers returned, then exception 
> is raised (versions are checked when  sequence is used - so it is new feature 
> for both of sides :-)  )
> I tried test this by hands and achieved the same behavior. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to