Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
com.microsoft.azure:azure-mariadb-connector-java
Advanced tools
MariaDB Java client with redirection support for Azure MySQL/MariaDB. Take advantage of this client to improve the connection latency between application front end and Azure Database for MySQL/MariaDB.
For general introduction for MariaDB java connector, please check on https://github.com/MariaDB/mariadb-connector-j . The source code here is in the latest version same with the related branch on https://github.com/MariaDB/mariadb-connector-j with redirection feature support. Following is a brief guide of how to build and test the driver.
The source code here is in the latest status same with the realted branch on https://github.com/MariaDB/mariadb-connector-j with redirection feature support(2020-06-03). Valid branches:
Notice There is an issue traced for MariaDB/mariadb-connector-j 2.5.2+ on https://jira.mariadb.org/browse/CONJ-807. The problem has been fixed on 2.7.0. The recommended branch is 2.7.0-with-redirection or 2.5.1-with-redirection.
A new connection option is introduced for redirection and the option name is enableRedirect, default value: off.
The detailed usage of the option enableRedirect is as follows:
off(0) | - Redirection will not be used. |
on(1) |
Will enforce redirection. - If redirection is not supported on the server, the connection will be aborted and the following error is returned: "Connection aborted because redirection is not enabled on the MySQL server or the network package doesn't meet redirection protocol." - If the MySQL server supports redirection, but the redirected connection failed for any reason, also abort the first proxy connection. Return the error of the redirected connection. |
preferred(2) | - It will use redirection if possible. - If the connection does not use SSL on the driver side, the server does not support redirection, or the redirected connection fails to connect for any non-fatal reason while the proxy connection is still a valid one, it will fall back to the first proxy connection. |
mvn package
The default test database names is testj which need to be created ahead, user is root, and without password. You can also specify the connection string as follows for test:
mvn -DdbUrl=jdbc:mariadb://localhost:3306/testj?user=root&password=xxx -DlogLevel=FINEST package
Please notice that the unit test sets is not designed fully compatibitale with Azure MySQL server, so don't run this test against Azure MySQL server and expect a full pass.
If you want to build without running unit tests and document check, use:
mvn -Dmaven.javadoc.skip=true -Dmaven.test.skip=true package
After build, you should have JDBC jar mariadb-java-client-x.y.z.jar in the 'target' subdirectory, e.g. mariadb-java-client-2.5.1.jar. Replace this jar with the mariadb-java-client jar package you currently used in your environemnt. Following are two use examples in different scenario:
After install, specify the connection string setting with enableRedirect option, e.g.
jdbc:mysql://xxx.mysql.database.azure.com/testj/?user=xx&password=xx&useSSL=true&serverSslCert=xx/BaltimoreCyberTrustRoot.crt.pem&enableRedirect=on"
Notice: Please notice that there is a limitation for Azure DB for MySQL where redirection is only possible when the connection is configured with SSL and only works with TLS 1.2 with a FIPS approved cipher for redirection.
// Load the JDBC driver
Class.forName("org.mariadb.jdbc.Driver");
System.out.println("Driver loaded");
int count = 10;
String query = "SELECT 1";
int i=0;
// Try to connect
String url = "jdbc:mysql://xxx.mysql.database.azure.com"+
"?verifyServerCertificate=false"+
"&useSSL=true"+
"&requireSSL=true" +
"&enableRedirect=on";
Connection connection = DriverManager.getConnection (url, "username", "password");
double t1 = System.nanoTime();
Statement s1 = connection.createStatement();
for(i=0;i<count;i++)
{
s1.executeQuery(query);
}
double t2 = System.nanoTime();
System.out.println (" time = " + (t2 - t1)/count/1000000);
connection.close();
FAQs
MariaDB Java client with redirection support for Azure MySQL/MariaDB. Take advantage of this client to improve the connection latency between application front end and Azure Database for MySQL/MariaDB.
We found that com.microsoft.azure:azure-mariadb-connector-java demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.