本文整理汇总了Java中com.mysql.jdbc.Util.isEnterpriseEdition方法的典型用法代码示例。如果您正苦于以下问题:Java Util.isEnterpriseEdition方法的具体用法?Java Util.isEnterpriseEdition怎么用?Java Util.isEnterpriseEdition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mysql.jdbc.Util
的用法示例。
在下文中一共展示了Util.isEnterpriseEdition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTLSVersion
import com.mysql.jdbc.Util; //导入方法依赖的package包/类
/**
* Tests fix for WL#8196, Support for TLSv1.2 Protocol.
*
* This test requires community server (with yaSSL) in -Dcom.mysql.jdbc.testsuite.url and
* commercial server (with OpenSSL) in -Dcom.mysql.jdbc.testsuite.url.sha256default
*
* Test certificates from testsuite/ssl-test-certs must be installed on both servers.
*
* @throws Exception
* if the test fails.
*/
public void testTLSVersion() throws Exception {
final String[] testDbUrls;
Properties props = new Properties();
props.setProperty("allowPublicKeyRetrieval", "true");
props.setProperty("useSSL", "true");
props.setProperty("requireSSL", "true");
props.setProperty("trustCertificateKeyStoreUrl", "file:src/testsuite/ssl-test-certs/ca-truststore");
props.setProperty("trustCertificateKeyStoreType", "JKS");
props.setProperty("trustCertificateKeyStorePassword", "password");
if (this.sha256Conn != null && ((MySQLConnection) this.sha256Conn).versionMeetsMinimum(5, 5, 7)) {
testDbUrls = new String[] { BaseTestCase.dbUrl, sha256Url };
} else {
testDbUrls = new String[] { BaseTestCase.dbUrl };
}
for (String testDbUrl : testDbUrls) {
System.out.println(testDbUrl);
System.out.println(System.getProperty("java.version"));
Connection sslConn = getConnectionWithProps(testDbUrl, props);
assertTrue(((MySQLConnection) sslConn).getIO().isSSLEstablished());
ResultSet rset = sslConn.createStatement().executeQuery("SHOW STATUS LIKE 'ssl_version'");
assertTrue(rset.next());
String tlsVersion = rset.getString(2);
System.out.println("TLS version: " + tlsVersion);
System.out.println();
System.out.println("MySQL version: " + ((MySQLConnection) sslConn).getServerVersion());
String etp = ((MySQLConnection) sslConn).getEnabledTLSProtocols();
System.out.println("enabledTLSProtocols: " + etp);
System.out.println();
System.out.println("JVM version: " + Util.getJVMVersion());
System.out.println();
if (((MySQLConnection) sslConn).versionMeetsMinimum(5, 7, 10) && Util.getJVMVersion() > 6) {
if (Util.isEnterpriseEdition(((MySQLConnection) sslConn).getServerVersion())) {
assertEquals("TLSv1.2", tlsVersion);
} else {
assertEquals("TLSv1.1", tlsVersion);
}
} else {
assertEquals("TLSv1", tlsVersion);
}
sslConn.close();
}
}
示例2: isEnterpriseEdition
import com.mysql.jdbc.Util; //导入方法依赖的package包/类
/**
* Checks whether the server we're connected to is an MySQL Enterprise edition
*/
protected boolean isEnterpriseEdition() {
return Util.isEnterpriseEdition(((MySQLConnection) this.conn).getServerVersion());
}
示例3: testTLSVersion
import com.mysql.jdbc.Util; //导入方法依赖的package包/类
/**
* Tests fix for WL#8196, Support for TLSv1.2 Protocol.
*
* This test requires community server (with yaSSL) in -Dcom.mysql.jdbc.testsuite.url and
* commercial server (with OpenSSL) in -Dcom.mysql.jdbc.testsuite.url.sha256default
*
* Test certificates from testsuite/ssl-test-certs must be installed on both servers.
*
* @throws Exception
* if the test fails.
*/
public void testTLSVersion() throws Exception {
final String[] testDbUrls;
Properties props = new Properties();
props.setProperty("allowPublicKeyRetrieval", "true");
props.setProperty("useSSL", "true");
props.setProperty("requireSSL", "true");
props.setProperty("trustCertificateKeyStoreUrl", "file:src/testsuite/ssl-test-certs/ca-truststore");
props.setProperty("trustCertificateKeyStoreType", "JKS");
props.setProperty("trustCertificateKeyStorePassword", "password");
if (this.sha256Conn != null && ((MySQLConnection) this.sha256Conn).versionMeetsMinimum(5, 5, 7)) {
testDbUrls = new String[] { BaseTestCase.dbUrl, sha256Url };
} else {
testDbUrls = new String[] { BaseTestCase.dbUrl };
}
for (String testDbUrl : testDbUrls) {
System.out.println(testDbUrl);
System.out.println(System.getProperty("java.version"));
Connection sslConn = getConnectionWithProps(testDbUrl, props);
assertTrue(((MySQLConnection) sslConn).getIO().isSSLEstablished());
ResultSet rset = sslConn.createStatement().executeQuery("SHOW STATUS LIKE 'ssl_version'");
assertTrue(rset.next());
String tlsVersion = rset.getString(2);
System.out.println(tlsVersion);
System.out.println();
if (((MySQLConnection) sslConn).versionMeetsMinimum(5, 7, 10) && Util.getJVMVersion() > 6) {
if (Util.isEnterpriseEdition(((MySQLConnection) sslConn).getServerVersion())) {
assertEquals("TLSv1.2", tlsVersion);
} else {
assertEquals("TLSv1.1", tlsVersion);
}
} else {
assertEquals("TLSv1", tlsVersion);
}
sslConn.close();
}
}