diff options
author | CVS to git conversion script <webmaster@postgresql.org> | 2002-11-04 17:14:30 +0000 |
---|---|---|
committer | CVS to git conversion script <webmaster@postgresql.org> | 2002-11-04 17:14:30 +0000 |
commit | 503b41f6e5db97b79911c140310d9d2abbac0232 (patch) | |
tree | 1a26ca24ac4cf57d0fd3b7cf4c4dd482defdcaeb /src/interfaces/jdbc/utils/CheckVersion.java | |
parent | 3f435f9e9950c35fbc5f774d2505951855b30263 (diff) |
This commit was manufactured by cvs2git to create branch 'REL7_3_STABLE'.
Sprout from master 2002-11-04 17:14:29 UTC Tom Lane <tgl@sss.pgh.pa.us> 'Remove extraneous semicolons after routine bodies. These don't bother'
Cherrypick from master 2002-09-04 07:23:04 UTC Bruce Momjian <bruce@momjian.us> 'Brand 7.3. Ready for beta!':
contrib/xml/README
contrib/retep/CHANGELOG
contrib/retep/Implementation
contrib/retep/Makefile
contrib/retep/README
contrib/retep/build.xml
contrib/retep/data/cds.dtd
contrib/retep/data/cds.xml
contrib/retep/uk/org/retep/tools.properties
contrib/retep/uk/org/retep/dtu/DCollection.java
contrib/retep/uk/org/retep/dtu/DConstants.java
contrib/xml/pgxml_dom.source
contrib/retep/uk/org/retep/dtu/DElement.java
contrib/retep/uk/org/retep/dtu/DEnvironment.java
contrib/retep/uk/org/retep/dtu/DModule.java
contrib/retep/uk/org/retep/dtu/DModuleXML.java
contrib/retep/uk/org/retep/dtu/DNode.java
contrib/retep/uk/org/retep/dtu/DProcessor.java
contrib/retep/uk/org/retep/dtu/DTransform.java
contrib/retep/uk/org/retep/tools/Tool.java
contrib/retep/uk/org/retep/util/ExceptionDialog.java
contrib/retep/uk/org/retep/util/Globals.java
contrib/retep/uk/org/retep/util/Logger.java
contrib/retep/uk/org/retep/util/Main.java
contrib/retep/uk/org/retep/util/StandaloneApp.java
contrib/retep/uk/org/retep/util/hba/Editor.java
contrib/retep/uk/org/retep/util/misc/IPAddress.java
contrib/retep/uk/org/retep/util/misc/PropertiesIO.java
contrib/retep/uk/org/retep/util/misc/WStringTokenizer.java
contrib/retep/uk/org/retep/util/models/HBATableModel.java
contrib/retep/uk/org/retep/util/models/PropertiesTableModel.java
contrib/retep/uk/org/retep/util/proped/PropertyEditor.java
contrib/retep/uk/org/retep/xml/core/XMLFactory.java
contrib/retep/uk/org/retep/xml/core/XMLFactoryException.java
contrib/retep/uk/org/retep/xml/jdbc/XMLDatabase.java
contrib/retep/uk/org/retep/xml/jdbc/XMLResultSet.java
contrib/retep/uk/org/retep/xml/parser/TagListener.java
contrib/retep/uk/org/retep/xml/test/XMLExport.java
doc/src/sgml/libpgeasy.sgml
doc/src/sgml/odbc.sgml
contrib/xml/pgxml.source
doc/src/sgml/recovery.sgml
src/test/regress/expected/geometry-bsdi-precision.out
contrib/retep/uk/org/retep/xml/parser/TagHandler.java
doc/src/sgml/version.sgml
doc/src/sgml/y2k.sgml
contrib/retep/retep.jpx
src/interfaces/jdbc/utils/CheckVersion.java
src/interfaces/jdbc/utils/changelog.pl
contrib/retep/uk/org/retep/util/hba/Main.java
contrib/retep/uk/org/retep/util/hba/Record.java
contrib/retep/uk/org/retep/util/proped/Main.java
src/interfaces/jdbc/CHANGELOG
src/interfaces/jdbc/Implementation
src/interfaces/jdbc/utils/buildDriver
src/interfaces/jdbc/jdbc.jpx
Diffstat (limited to 'src/interfaces/jdbc/utils/CheckVersion.java')
-rw-r--r-- | src/interfaces/jdbc/utils/CheckVersion.java | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/interfaces/jdbc/utils/CheckVersion.java b/src/interfaces/jdbc/utils/CheckVersion.java new file mode 100644 index 00000000000..a2438cd4f9f --- /dev/null +++ b/src/interfaces/jdbc/utils/CheckVersion.java @@ -0,0 +1,74 @@ +package utils; + +/* + * This little app checks to see what version of JVM is being used. + * It does this by checking first the java.vm.version property, and + * if that fails, it looks for certain classes that should be present. + */ +public class CheckVersion +{ + /* + * Check for the existence of a class by attempting to load it + */ + public static boolean checkClass(String c) + { + try + { + Class.forName(c); + } + catch (Exception e) + { + return false; + } + return true; + } + + /* + * This first checks java.vm.version for 1.1, 1.2 or 1.3. + * + * It writes jdbc1 to stdout for the 1.1.x VM. + * + * For 1.2 or 1.3, it checks for the existence of the javax.sql.DataSource + * interface, and if found writes enterprise to stdout. If the interface + * is not found, it writes jdbc2 to stdout. + * + * PS: It also looks for the existence of java.lang.Byte which appeared in + * JDK1.1.0 incase java.vm.version is not heeded by some JVM's. + * + * If it can't work it out, it writes huho to stdout. + * + * The make file uses the written results to determine which rule to run. + * + * Bugs: This needs thorough testing. + */ + public static void main(String args[]) + { + String vmversion = System.getProperty("java.vm.version"); + + System.out.println("postgresql.jdbc=" + System.getProperty("postgresql.jdbc")); + + // We are running a 1.1 JVM + if (vmversion.startsWith("1.1")) + { + System.out.println("jdbc1"); + //System.exit(0); + } + else + // We are running a 1.2 or 1.3 JVM + if (vmversion.startsWith("1.2") || + vmversion.startsWith("1.3") || + checkClass("java.lang.Byte") + ) + { + + // Check to see if we have the standard extensions. If so, then + // we want the enterprise edition, otherwise the jdbc2 driver. + if (checkClass("javax.sql.DataSource")) + System.out.println("enterprise"); + else + System.out.println("jdbc2"); + //System.exit(0); + } + System.setProperty("postgresql.jdbc", "yoyo"); + } +} |