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

Rick Hillegas commented on DERBY-5818:
--------------------------------------

Thanks for the feedback, Saurabh and Bryan. If we decide to add a new builtin 
function, how about calling it something a little shorter, like 
"database_version()"?

Suppose the new function returns exactly the same information as "values 
syscs_util.syscs_get_database_property( 'DataDictionaryVersion' )". Then, as 
Knut notes, does the new function add much value? Maybe we should just document 
the existing technique of invoking "values 
syscs_util.syscs_get_database_property( 'DataDictionaryVersion' )".

Here are pro's and con's of the two approaches:

A) Introduce a new database_version() builtin function, which returns a two 
part major.minor version string:

+ Short and sweet.
- Won't work for old versions of derby.jar (versions before 10.10.1).


B) Document existing syscs_util.syscs_get_database_property( 
'DataDictionaryVersion' ) behavior:

+ Works for all versions of derby.jar.
- Exposes an internal key whose name awkwardly violates Derby's conventions for 
property names.
- Increases (slightly) the risk that someone will accidentally corrupt their 
database as described by DERBY-5838.


Here are responses to Saurabh's other questions:

Saurabh> Is it possible to provide backward compatible and pure SQL solution if 
we go for option 1?

Solutions (A) and (B) are both backward compatible, pure SQL approaches which 
will work with a derby.jar at version 10.10.1 and return the database version 
as a two part major.minor id. Solution (B) will also work with previous 
versions of derby.jar.

Saurabh?> Do we have any system table, property etc which stores the version 
level (4 part or 2 part version id) of derby jar? 

The version of derby.jar isn't stored in any system table or property. You 
can't query it via any builtin SQL mechanism. The DBMDWrapper solution can be 
used with old versions of derby.jar (back to 10.4.1). A simpler variation of 
the DBMDWrapper solution, limited to just the getDatabaseProductVersion(), 
could be used on older versions of derby.jar. These solutions are SQL-based but 
not builtin.

What are your thoughts?


Thanks,
-Rick

                
> values syscs_util.syscs_get_database_property('DataDictionaryVersion' ) does 
> not return full version information
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5818
>                 URL: https://issues.apache.org/jira/browse/DERBY-5818
>             Project: Derby
>          Issue Type: Bug
>            Reporter: Saurabh Kejriwal
>         Attachments: derby-5818-01-aa-dictionaryVersionFunction.diff
>
>
> Details 
> ------------
> $ ./sysinfo 
> ------------------ Java Information ------------------
> Java Version:    1.6.0
> Java Vendor:     Sun Microsystems Inc.
> Java home:       /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre
> Java classpath:  
> /scratch/ansverma/JavaDBnew/db-derby-10.8.2.2-bin/lib/derby.jar:/scratch/ansverma/JavaDBnew/db-derby-10.8.2.2-bin/lib/derbynet.jar:/scratch/ansverma/JavaDBnew/db-derby-10.8.2.2-bin/lib/derbytools.jar:/scratch/ansverma/JavaDBnew/db-derby-10.8.2.2-bin/lib/derbyclient.jar
> OS name:         Linux
> OS architecture: i386
> OS version:      2.6.18-164.0.0.0.1.el5xen
> Java user name:  ansverma
> Java user home:  /home/ansverma
> Java user dir:   /scratch/ansverma/JavaDBnew/db-derby-10.8.2.2-bin/bin
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.6
> java.runtime.version: 1.6.0-b09
> --------- Derby Information --------
> JRE - JDBC: Java SE 6 - JDBC 4.0
> [/scratch/ansverma/JavaDBnew/db-derby-10.8.2.2-bin/lib/derby.jar] 10.8.2.2 - 
> (1181258)
> [/scratch/ansverma/JavaDBnew/db-derby-10.8.2.2-bin/lib/derbytools.jar] 
> 10.8.2.2 - (1181258)
> [/scratch/ansverma/JavaDBnew/db-derby-10.8.2.2-bin/lib/derbynet.jar] 10.8.2.2 
> - (1181258)
> [/scratch/ansverma/JavaDBnew/db-derby-10.8.2.2-bin/lib/derbyclient.jar] 
> 10.8.2.2 - (1181258)
> ------------------------------------------------------
> ----------------- Locale Information -----------------
> Current Locale :  [English/United States [en_US]]
> Found support for locale: [cs]
>          version: 10.8.2.2 - (1181258)
> Found support for locale: [de_DE]
>          version: 10.8.2.2 - (1181258)
> Found support for locale: [es]
>          version: 10.8.2.2 - (1181258)
> Found support for locale: [fr]
>          version: 10.8.2.2 - (1181258)
> Found support for locale: [hu]
>          version: 10.8.2.2 - (1181258)
> Found support for locale: [it]
>          version: 10.8.2.2 - (1181258)
> Found support for locale: [ja_JP]
>          version: 10.8.2.2 - (1181258)
> Found support for locale: [ko_KR]
>          version: 10.8.2.2 - (1181258)
> Found support for locale: [pl]
>          version: 10.8.2.2 - (1181258)
> Found support for locale: [pt_BR]
>          version: 10.8.2.2 - (1181258)
> Found support for locale: [ru]
>          version: 10.8.2.2 - (1181258)
> Found support for locale: [zh_CN]
>          version: 10.8.2.2 - (1181258)
> Found support for locale: [zh_TW]
>          version: 10.8.2.2 - (1181258)
> ------------------------------------------------------
> Description
> -----------------
> I am using Derby 10.8.2.2. I want to get derby version details through SQL. I 
> ran following query to retrieve version information. 
> $ java -jar 
> /scratch/ansverma/JavaDBnew//db-derby-10.8.2.2-bin/lib/derbyrun.jar ij
> ij version 10.8
> ij> CONNECT 'jdbc:derby:test2;user=test2;password=test2';
> ij> values syscs_util.syscs_get_database_property('DataDictionaryVersion');   
>  
> 1                                                                             
>                                                   
> --------------------------------------------------------------------------------------------------------------------------------
> 10.8                                                                          
>                                                   
> 1 row selected
> It did not return full version information (10.8.2.2) for Derby. 
> Expected result =  10.8.2.2
> Actual result = 10.8
> I want the version details through SQL query.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to