MySQL Connector/Python 2.2.2 m3 Development Release has been released

MySQL Connector/Python 2.2.2 M3 is the third development release of the MySQL Connector Python 2.2 series. This series adds support for the new X DevAPI. The X DevAPI enables application developers to write code that combines the strengths of the relational and document models using a modern, NoSQL-like syntax that does not assume previous experience writing traditional SQL.

To learn more about how to write applications using the X DevAPI, see http://dev.mysql.com/doc/x-devapi-userguide/en/index.html. For more information about how the X DevAPI is implemented in MySQL Connector/Python, and its usage, see http://dev.mysql.com/doc/dev/connector-python.

Please note that the X DevAPI requires at least MySQL Server version 5.7.12 or higher with the X Plugin enabled. For general documentation about how to get started using MySQL as a document store, see http://dev.mysql.com/doc/refman/5.7/en/document-store.html.

To download MySQL Connector/Python 2.2.2 M3, see the “Development Releases” tab at http://dev.mysql.com/downloads/connector/python/

We are working on the github upload, it should be available soon.

Enjoy!

Changes in MySQL Connector/Python 2.2.2 (2016-12-01, Milestone 3)
* Functionality Added or Changed

* Bugs Fixed Functionality Added or Changed

* If the MySQL server is configured to support secure connections, Connector/Python now attempts to establish a secure (encrypted) connection by default, falling back to an unencrypted connection otherwise. This is behavior similar to the –ssl-mode=PREFERRED option supported by MySQL client programs.
The following TLS/SSL options have been implemented for the mysqlx URI schema. All require Python 2.7.9 or higher.

+ ssl-enable: This option enforces SSL connections. If given, a connection attempt must be able to establish a secure connection or the attempt fails.

+ ssl-ca: This option is used to verify the server certificate.

+ ssl-cert, ssl-key: These options are used to pass the client certificate and key, but the server currently does not validate the client using these.
The ssl-enable parameter can be specified in a parameter dictionary or URL, like this:
mysqlx.get_session({“user”: “root”, “host”: “localhost”, “port”: 33060,
“password”: “pass”, “ssl-enable”: True})
Or:
mysqlx.get_session(“mysqlx://root:pass@localhost?ssl-enable”)

The other parameters are used similarly. In a URL, path name values should be given within parentheses; for example, ssl-cert=(path_name). (Bug #24954646)

* There is now a standard API to create a table: Schema objects have a create_table function. It throws an error if the table exists.

* For any method that takes a value list of parameters for its argument, there is now more flexibility with how the parameters can be specified: Either as a value list or a list of individual parameters. For example, these method calls are the same:
Collection.add([{“a”: 27}, {“a”: 28}])
Collection.add({“a”: 27}, {“a”: 28})
* For Schema objects, get_view, create_view, alter_view,
and drop_view functions were added to support retrieval,
create, alter, and drop operations on View objects.

* Unix domain socket files are now supported as a connection transport. The socket file can be specified in a parameter dictionary or URL, like this:
mysqlx.get_session({“user”: “root”, “password”: “pass”,
“socket”: “/path/to/socket”})
Or:
mysqlx.get_session(“mysqlx://user:pass@(/path/to/sock)/schema”)
mysqlx.get_session(“mysqlx://user:pass@/path%2Fto%2Fsock/schema”)
mysqlx.get_session(“mysqlx://user:pass@.%2Fpath%2Fto%2Fsock/schema”)
mysqlx.get_session(“mysqlx://user:pass@..%2Fpath%2Fto%2Fsock/schema”)

Bugs Fixed

* For a user created with REQUIRE SSL, establishing an SSL connection by specifying –ssl-key but not –ssl-ca or
–ssl-cert fails for standard MySQL client programs. The same connection configuration was (improperly) permitted in Connector/Python. (Bug #24953032)

* Connection failures due to an improper SSL CA resulted in an uninformative error message. (Bug #24948054)

* Using a schema object to alter a view failed if the view selected from a non-INFORMATION_SCHEMA table and it was altered to select from an INFORMATION_SCHEMA table. (Bug
#24947078)

* schema.create_collection() with an empty collection name threw an improper error. (Bug #24520850)

Documentation
——————–

Online:http://dev.mysql.com/doc/connector-python/en/index.html The source distribution includes the manual in various formats under the docs/ folder.

Reporting Bugs
——————–

We welcome and appreciate your feedback and bug reports:
http://bugs.mysql.com/

On Behalf of the MySQL/ORACLE RE Team,
Balasubramanian Kandasamy

MySQL Connector/Node.js 1.0.5 m4 development has been released

MySQL Connector/Node.js is a new Node.js driver for use with the X DevAPI. This release, v1.0.5 M4, is the fourth development release of the MySQL Connector/Node.js 1.0 series.

The X DevAPI enables application developers to write code that combines the strengths of the relational and document models using a modern, NoSQL-like syntax that does not assume previous experience writing traditional SQL.

To learn more about how to write applications using the X DevAPI, see
http://dev.mysql.com/doc/x-devapi-userguide/en/index.html. For more information about how the X DevAPI is implemented in MySQL Connector/Node.js, and its usage, see http://dev.mysql.com/doc/dev/connector-nodejs.

Note

Please note that the X DevAPI requires at least MySQL Server version 5.7.12 or higher with the X Plugin enabled. For general documentation about how to get started using MySQL as a document store, see
http://dev.mysql.com/doc/refman/5.7/en/document-store.html.

Functionality Added or Changed

  • Added APIs for Transaction handling.
  • Added a Table creation API.

Enjoy and thanks for the support!

On behalf of the MySQL/Oracle Release Engineering Team
Piotr Obrzut

MySQL Connector/NET 7.0.6 m5 development has been released

MySQL Connector/Net 7.0.6 is the third development release that expands cross-platform support to Linux and OS X when using Microsoft’s .NET Core framework. Now,
.NET developers can use the X DevAPI with .NET Core and Entity Framework Core
(EF Core) 1.0 to create server applications that run on Windows, Linux and OS X.
We are very excited about this change and really look forward to your feedback on it!

MySQL Connector/Net 7.0.6 is also the fifth development release of MySQL Connector/Net to add support for the new X DevAPI. The X DevAPI enables
application developers to write code that combines the strengths of the
relational and document models using a modern, NoSQL-like syntax that
does not assume previous experience writing traditional SQL.

To learn more about how to write applications using the X DevAPI, see
http://dev.mysql.com/doc/x-devapi-userguide/en/index.html. For more
information about how the X DevAPI is implemented in Connector/Net, see
http://dev.mysql.com/doc/dev/connector-net.

Note

The X DevAPI requires at least MySQL Server version 5.7.12 or higher with
the X Plugin enabled. For general documentation about how to get started
using MySQL as a document store, see
http://dev.mysql.com/doc/refman/5.7/en/document-store.html.

To download MySQL Connector/Net 7.0.6 M5, see the “Development
Releases” tab at http://dev.mysql.com/downloads/connector/net/

Functionality Added or Changed

  • X DevAPI: The SessionConfig class, SessionConfigManager class, and IpersistenceHandler interface were added for session-configuration management to represent all the information associated with a session.
  • EF Core: Added all-platform compliance support for the .NET Framework stack (Console, WPF, WinForms, and ASP.NET) and compatibility with ASP.NET 5 when using the .NET Framework or .NET Core version.
    Changes in MySQL Connector/Net 7.0.6 (2016-10-28)
  • Added the following functionality for saving changes in EF Core:
    • Basic save operation to persist entity-instance changes to the database.
    • Optimistic concurrency to protect against overwriting changes made by another user after data was fetched from the database.

Bugs Fixed

  • EF Core: A missing function used when a model is added or changed caused the migration generation to fail. MySQLHistoryRepository now implements get_existssql(). (Bug #24804771)
  • EF Core: An SQL syntax error was emitted when the Contains operator was used in the Where predicate of a LINQ query. This fix requires the use of EF Core version
    1.1 or later. (Bug #24797524)
  • An Entity Framework DbContext object created with a column of type DateTimeOffset returned an error indicating that DateTimeOffset values were incompatible with DateTime and Timestamp values. (Bug #24732001)
  • X DevAPI: The GetCollections(), GetTable(), and GetTables() methods threw
    System.InvalidOperationException: name is not a valid column name in the row. (Bug #24385662)

Nuget

Packages are available at:

https://www.nuget.org/packages/MySql.Data/7.0.6-IR31
https://www.nuget.org/packages/MySql.Web/7.0.6-IR3
https://www.nuget.org/packages/MySql.Data.Entity/7.0.6-IR3
https://www.nuget.org/packages/MySql.Data.EntityFrameworkCore/7.0.6-IR31 

Enjoy and thanks for the support!

On behalf of the MySQL/Oracle Release Engineering Team

Develop by Example – Document Store: Working with Express.js, AngularJS and Node.js

In previous blog posts we explained how to perform certain actions in a MySQL database set up as a document store using Connector/Node.js. In this blog post we are going to use some of the examples covered to explain how to start working with an application created with Express.js, AngularJS, Node.js, and MySQL Connector/Node.js.

Required

Optional

Before we start we need to install MySQL Server, Node.js and download MySQL Connector/Node.js.

Configuring MySQL Server

If you are using Windows and you installed MySQL Server using the MySQL Installer you might have already enabled the MySQL X Protocol plugin or you can enable it through a re-configuration of the MySQL Server, for more details go to the Plugins and Extensions section in the official documentation.

If you are not using windows or the MySQL Installer, once MySQL Server is installed and running we need to enable the X Plugin to be able to use MySQL as a document store.

To enable the X Plugin in the MySQL server using the MySQL command-line client you need to use the root account or an account with INSERT privilege on the mysql.plugin table:

  • Invoke the MySQL command-line client: mysql -u user –p
  • Run the following command: INSTALL PLUGIN mysqlx SONAME ‘mysqlx.so’;

Note: Replace mysqlx.so with mysqlx.dll for Windows.

Please refer to the official documentation for more information about setting up MySQL as a document store.

Installing and using Express

After Node.js is also installed we need to open a terminal and navigate to the path where we want to create our project. Once we are in the desired path, we are going to install the Express application generator, which will help us to create the skeleton for our application. To install it, run the following command in the terminal:

$ npm install express-generator g

The -g flag specifies that the package will be installed globally.

Now we are going to create the skeleton for our application by running the following command the in terminal:

$ express mysql-news --ejs

The –ejs flag is to specify that we are going to use EJS as our template language to use standard HTML instead of Jade, which is the default view engine used by Express. The name for our application was specified as mysql-news. After running the command, we are going to see a folder with the same name as our application with the following structure:

mysql-news/
├───app.js
├───package.json
├───bin/
└─www
├───public/
├───images/
├───javascripts/
└───stylesheets/
└─style.css
├───routes/
├─index.js
└─users.js
└───views
├─error.ejs
└─index.ejs

Now we need to install the dependencies of the template created. Run the following command in the terminal at the path level were our application folder were created:

$ cd mysql-news && npm install

To start the newly created application, run the following command in the terminal:

$ npm start

To verify that our application is running, open a browser and type: http://localhost:3000.
If everything it is ok, we will be able to see a webpage with the text: “Welcome to Express”

Installing MySQL Connector/Node.js

In our application folder copy the MySQL Connector/Node.js tar.gz file that you may have downloaded previously. Once it has copied, run the following command to add the package to our application:

$ npm install mysql-connector-nodejs-1.0.4.tar.gz

Note: verify that the version of the file downloaded matches the version of the command.

Once MySQL Connector/Node.js is installed, we can navigate to the path /node_modules/@mysql/xdevapi to see where it is located.

Installing AngularJS and Angular-Route

In this blog post we are going to use AngularJS and the Angular-Route module both using the 1.5.8 version. To install them, run the following command:

$ npm install angular@1.5.8 angular-route@1.5.8

Once the packages are downloaded and installed in the node_modules folder we are going to copy the folders angular and angular-route inside our public/javascripts folder.

Note: to avoid doing this manually you can install Bower, use the CDN for the AngularJS modules, or any other alternative.

Optional Software

Now just the optional software is left. If you want a visual representation of the schema and collections in the application, download and install MySQL Workbench. And if you want to add a boost to the front-end development, install Bootstrap. In this blog post we are using just the CDN for the CSS, but you can install the complete package.

The folder structure

The last thing before we start working on the code of our application is to create two folders in the root path of our application: models and data. In the end, our application will have something like the following structure:
mysql-news/
├───app.js
├───mysql-connector-nodejs-1.0.4.tar.gz
├───package.json
├───bin/
└─www
├───data/
├───models/
├───node_modules/
├───public/
├───images/
├───javascripts/
└───stylesheets/
└─style.css
├───routes/
├─index.js
└─users.js
└───views
├─error.ejs
└─index.ejs

Building the application

Uploading initial data

As you may have guessed by its name, this application will display news about MySQL. We will have the ability to create new posts or add comments to the news items that are already in the database.

Now we can start building out our application. The first thing that we are going to do is to add a JSON file in the data folder. We are going to name it news.json or you can choose another name. Copy and paste the following data to the file:

This initial data will help us to visualize our progress. To continue we need to update our application to create our schema and collection where we are going to upload the initial data.

Open the www file that it is inside the bin folder. This file contains the configuration for the web server that will host our application. The first thing that we are going to add is a function that creates our schema, our collection, and then upload the data to the collection. Add the following code at the end of the file:

In the previous code we define the configureDataBase function where we create a session to our local instance of MySQL server. Once we have the session we verify if the schema mysqlNews exists. If not, we create it and the news collection. Finally, we load the initial data into the news collection.

We have the function that initializes our schema and now we need to add another function that calls it just one time when the application starts. In the www file you will find a section that creates the http server below the line:

var server = http.createServer(app);

We are going to add the following code below that line:

In the previous code first we load our initial data into the initialData variable as well as the xdevapi module into the mysql variable. These variables are used by the configureDataBase function. The variables need to be defined before the function is called. Then we create an instance of an EventEmitter, and we configure the event that is in charge of calling the function that creates our schema and collection.

To complete the configuration, we just need to add the following lines inside the initializeDatabase function:

Note: the lines should be below our initializeDatabase function, verify that are not duplicated

Since we are going to load some data when the application starts, we need to first configure our database before the server accepts connections, that is the reason we are moving the above lines inside our function. In the end, our function should look like this:

Now that we have the code that configures our schema and loads some initial data, it is time to create the function that retrieves the data from the collection.


Getting the data

In our model folder we are going to add a new file called news.js. This module will contain all the methods used to perform actions in our collections. The first method that we are going to add to this module is the one that gets the documents from our collection.

First we are going to define two variables, one to load the MySQL xdevapi module and other one to store the configuration used to create connections to our server.

Now we are going to create the method that returns all the documents stored in our collection:

First we added the method getAll to the exports object of our module and then we call the getSession method to create a connection to our server. Once we have the session we get the schema and the collection where our documents are stored. We define an array variable to store the documents returned from the collection and we execute the find method without a filter to return all the documents. When the execute method is reached every document will be added to the array variable that will be returned. Then when the execute method is completed, if we received any document; we return null as the error message and the array of documents, or an error message and null as the array of documents otherwise.

Now we need to create the required files to call the method and display the documents from the database in the application.

In this blog post we are going to follow the folder structure suggested by AngularJS, putting each feature/entity in its own file and having a directory for feature. First we are going to create an AngularJS component named app.module.js inside the folder path public\javascripts, we are not creating a folder for this component because it will be used by all the features we are going to add.

In this file we are going to configure the modules required by the application and a factory to access the methods that we are going to add to our model file (news.js). For more information about a factory please see the AngularJS documentation.

We are going to add the following code in the file:

In the first line we set a name for our application (mysqlNews), and specify the modules that we are going to use: ngRoute and newsList. The newsList module is going to be the module that loads the documents in our application. And the ngRoute is an AngularJS module that provides the route and deeplinking services.

Then we create a factory that is going to be used by the other modules, the factory is named as newsFactory and we specify the module $http as the module that is going to be used by our factory. The $http module is core service that facilities the communication with the HTTP servers. Inside the factory we define an object that will have a property named news that will store the documents of our application and a method called getAll that will get the documents and copy them into the news property.

Now we are going to create another component named app.config.js, and also this component does not have a directory because will be used by all the features too. In this file we are going to configure the routes of our application.

In the previous code we set ‘!‘ as our prefix for our routing configuration and also we configure the template that is going to be used to load the news in our application.

To continue we are going to create a folder named newsList, this folder will contain the components and the template to display the news in our application. To this folder we are going to add a component named news-list.module.js with the following content:

angular.module('newsList', []);

The previous file just contains the name of this module, if we require additional modules we can set it here in this file. Now add another component named news-list.component.js with the following content:

The code we have just seen configures the template and also the controller that loads the documents into the template via the factory we created earlier. The news from the factory are copied to a property of the controller and then the method to get all the news is called, and also a property named order that is going to be used to sort the news, is added to the controller. The last file that we are going to add to this folder is the template file to display the documents. The file will be named news-list.template.html with the following content:

In the template we have a search and a filter section, and a list where we will display our documents. The search input is set to the controller’s search property that used in this template ($ctrl.search), the property is applied to the list of items to filter them. The sort select is set to the controller’s order property that is also applied to the list of items to sort them by title or by date published.

To complete this section code and have something we can test, we need to do just two more things. The first one is to update the file index.js that is inside the routes folder. We need to load our model, append the following line to the section where the variables to do that are defined:

var mysql = require('../models/news.js');

And we are going to add a new get method:

In the above method we are calling our model’s getAll method and sending back the information in JSON format. The last step to test our application is to update the index.ejs file inside the views folder.

And the second thing is to update our index file index.ejs. To start with, we update the html tag to include the language and the application name. The name is as defined in the app.module.js file: mysqlNews. If we do not set the ng-app directive AngularJS will not find the root element of our application and our components will not be loaded. The html tag should appear as follow:

<html lang="en" ng-app="mysqlNews">

Then we are going to add the link to our scripts and to the bootstrap CSS in the header:

And finally we are going to update the body adding the ng-view directive that is used by $route service to render the template configured by the current route loaded:

To test the application and verify that everything is configured properly, run the following command in a terminal and navigate to http://localhost:3000/:

$ npm start

We should see a search/sort section on the left-hand side of your browser and a list of the initial documents loaded to our collection next to it.

index

Adding Comments

At this time, we have an application that list the documents from a collection and let us do a search to filter the information and sort the documents by the published field. But the Comments section is still empty, so let us add the functionality to add comments.

Go to our model file news.js, and add the following method at the end:

In the previous method, first we create the session to work in our server then we get the schema and the collection. Once we have the collection we are calling the modify method specifying the _id of the post where we want to add the new comment. The comment is added to the document using the arrayAppend method which appends the comment to the end of the array. Once the execute method finishes, we verify how many documents were affected and sent the results back basis on it.

Then we need to update our factory (app.module.js), adding the new module that will be used to add comments newComment:

Also we need to add the AngularJS $location and $filter modules. We are going to use the $location module to change the URL of the application, and the $filter module to know to which post a new comment belongs.

Finally, we are going to add the method to create comments or cancel the addition:

In the addComment method, we send the data to the /comments route. Then the result returned is added to our local copy of the data. The $filter module is used to find by _id the post to which belongs the new comment. To finish we change the location of the application to the main page.

The next step is to update our route provider in the app.config.js file to handle the add comments route:

Now as we did for the components to display the news, we are going to create a folder in the public/javascripts path with the name comments, this folder will contain the components and the template to add new comments. We are going to start adding the new-comment.module.js component to the folder with the following content:

angular.module('newComment', ['ngRoute']);

In the file we are specifying that our new module has the name newComment and it will use the ngRoute module. To continue we are going to add another component named new-comment.component.js with the following code:

The previous code configures the template that is going to be used to add new comments and defines the controller to be used in the view. The controller receives the _id of the news to update and is stored in a controller property, then two methods are defined: addComment that sends the new comment to be added to our factory and cancelAddComment that cancels the current action.

The template that we are going to use to add new comments is going to be called new-comment.template.html and is defined next:

The item template consists only of a text area where the user can enter a comment and some basic validation. The Submit button is enabled only when the comment passes validation, this is done by the ng-disabled directive that check if all the inputs in the form (addComment) has valid values. The ng-model directive is used to set the value of the input to a controller’s property, comment is the property’s name in this case.

Then we need to update our route file (routes/index.js) adding a new method to save the new comments:

This method sends the new comment to the model to be stored in collection. Once it has been stored successfully, it returns the comment in JSON format.

We are going to add a link that will load the new view when it is clicked, we are going to update the template in the path javascripts/newsList/news-list.template.html adding the following code under the paragraph that lists the comments:

And the last step is to add the reference to our new scripts in the header of the index file (views/index.ejs):

To test these changes, run the following command in a terminal and navigate to http://localhost:3000/:

$ npm start

We see the new option to add coments:

add_comment

And when we click on it, we see a form to write new comments:

submit_comment

We see the new comment below the news item in the index page:

display_comment

Adding new posts

To finish the application, we are going to add the feature to add new posts to the application. We are going to start adding a new method to our model (models/news.js) at the end:

This new method accepts as a parameter a JSON object to be added to the collection. Once the new document is stored in the collection it is returned to the application. If the document cannot be stored, the method returns null and display an error message to the user.

Then we need to update our factory (app.module.js), and again the first thing to update is to add the new module that will be used to add new posts addNews:

Now we are going to add the new methods that add a new post or cancel the process:

The first method receives the data for the new post and sends it to the /addNews route, the document returned is added to our local copy of the data and the app location is changed to the index.

Next we are going to update our route provider in the app.config.js file to handle the add news route:

Now we are going to create a folder in the public/javascripts path with the name news. This folder will contain the components and the template used to add new posts. Then we continue adding the add-news.module.js component to the folder with the following content:

angular.module('addNews', ['ngRoute']);

In the component we are specifying that our new module has the name addNews and it will use the ngRoute module. Then we add another component named add-news.component.js with the following code:

The previous code configures the template that is going to be used to add new posts and defines the controller to be used in the view. The controller receives the data to create a JSON object and set the published date to be the current date. The addNews method sends the JSON object to the factory and the cancelAddNews method cancels the current action.

The last file for this folder is going to be the view template named add-news.template.html, and is defined with the following:

The item template contains the text inputs to set the Title, Link and Introduction for the new post. It also contains some validation checks to enable the Submit button just when the required fields are valid. Also the value of the inputs is set to the controller’s properties: title, link and introduction.

Then we need to update our route file (routes/index.js) adding a new method to save the new post:

This method sends the new post to our model and it returns the new document added in JSON format once it is saved in the collection.

We are going to add a link that will load the new view when it is clicked, we are going to update the file in the path javascripts/newsList/news-list.template.html adding the following code under the paragraph that has the search and sort options:

And the last step is to add the reference to our new scripts in the header of the index file (views/index.ejs):

To test the latest changes, run the following command in a terminal and navigate to http://localhost:3000/:

$ npm start

We see the new option to add new posts:

add_post

And when we click on it, we see a form to add new posts:

submit_post

After we add a new post, it is displayed in the index page:

display_post

In this post we learned how to create a full stack JavaScript application using MySQL, Node.js, Express, AngularJS. We hope you enjoyed the post and please stay tuned because we have a lot of new content to share with you.

See you in the next blog post.

MySQL Connector/Python 2.0.5 GA has been released

Dear MySQL users,

MySQL Connector/Python 2.0.5 GA is a new GA version of 2.0 release series of the pure Python database driver for MySQL. It can be used for production environments.

MySQL Connector/Python version 2.0.5 is compatible with MySQL Server versions 5.5 and greater. Python 2.6 and greater as well as Python 3.3 and greater are supported. Python 2.4, 2.5 and 3.1, 3.2 are not supported.

MySQL Connector/Python 2.0.5 is available for download from:
http://dev.mysql.com/downloads/connector/python/#downloads

The ChangeLog file included in the distribution contains a brief summary of changes in MySQL Connector/Python 2.0.5. For a more complete list of changes, see below or online at:
http://dev.mysql.com/doc/relnotes/connector-python/en/

Changes in MySQL Connector/Python 2.0.5 (2016-10-26)

Bugs Fixed

* A potential SQL injection vector was eliminated. (Bug #22529828, Bug #24816150)

Documentation
————-
The manual of MySQL Connector/Python is available online here:
http://dev.mysql.com/doc/connector-python/en/index.html

It is also available for download in various formats here:
http://dev.mysql.com/doc/index-connectors.html

Reporting Bugs
————–
We welcome and appreciate your feedback and bug reports:
http://bugs.mysql.com/

Enjoy !

On behalf of the MySQL Connector/Python and the MySQL/ORACLE RE Team
Hery Ramilison

MySQL Connector/C++ 2.0.3 m3 Development Release has been released

MySQL Connector/C++ 2.0.3 is the next development milestone of the MySQL Connector/C++ 2.0 series, and the first public release. Apart from covering more X DevAPI features, it adds a new, plain C API, called XAPI, that offers functionality similar to X DevAPI to applications written in plain C. Thus, not only can MySQL Connector/C++ be used to write C++ applications, as before.

Now, using the XAPI, MySQL Connector/C++ can be used to write plain C applications to access MySQL Database implementing a document store as well as execute traditional plain SQL statements. For more information about XAPI, refer to the documentation at http://dev.mysql.com/doc/dev/connector-cpp/xapi_ref.html.

To learn more about how to write applications using the X DevAPI, see X DevAPI User Guide (http://dev.mysql.com/doc/x-devapi-userguide/en/). For more information about how to use Connector/C++ 2.0 and how the X DevAPI is implemented in it, see http://dev.mysql.com/doc/dev/connector-cpp/.

Note

The X DevAPI requires at least MySQL Server version 5.7.12 or higher with the X Plugin enabled. For general documentation about how to get started using MySQL as a document store, see Using MySQL as a Document Store (http://dev.mysql.com/doc/refman/5.7/en/document-store.html).

To download MySQL Connector/C++ 2.0.3 m3, see the “Development Releases” tab at http://dev.mysql.com/downloads/connector/cpp/

X DevAPI Notes

New X DevAPI features added in this MySQL Connector/C++ release:

  • Methods for starting and controlling transactions
  • Using an X DevAPI URI or connection string to specify new session parameters
  • Capability of binding a session to the default shard and execute SQL statements there (using XSession.bindToDefaultShard())
  • Methods for counting elements in a table or collection
  • Access to multiple result sets if present in a query result
  • Methods to count items in a result set and fetch a complete result set at once (using fetchAll()), instead of accessing items one by one (using fetchOne())
  • Access to warnings reported when processing a statement (getWarnings())
  • Access to information about affected rows, generated auto-increment values, and identifiers of documents added to a collection

On Behalf of the MySQL/ORACLE RE Team

MySQL Connector/J 6.0.5 m4 Development Release has been released

Dear MySQL users,

MySQL Connector/J 6.0.5 m4 Development Release is a developer milestone
release for the 6.0.x series.
This release includes the following new features and changes, also described
in more detail on
http://dev.mysql.com/doc/relnotes/connector-j/6.0/en/news-6-0-5.html.

As always, we recommend that you check the “CHANGES” file in the download
archive to be aware of changes in behavior that might affect your application.

To download MySQL Connector/J 6.0.5 M4, see the “Development
Releases” tab at http://dev.mysql.com/downloads/connector/j/

Enjoy!

Changes in MySQL Connector/J 6.0.5 (2016-10-19, Milestone 4)

Version 6.0.5 Milestone is the forth development release of
the 6.0 branch of MySQL Connector/J, providing an insight
into upcoming features. It is suitable for use with MySQL
server versions 5.5, 5.6, and 5.7. It supports the Java
Database Connectivity (JDBC) 4.2 API.

Functionality Added or Changed

* Added support for the error codes of two MySQL server
errors, ER_XA_RBTIMEOUT
(http://dev.mysql.com/doc/refman/5.7/en/error-messages-se
rver.html#error_er_xa_rbtimeout) and ER_XA_RBDEADLOCK
(http://dev.mysql.com/doc/refman/5.7/en/error-messages-se
rver.html#error_er_xa_rbdeadlock). (Bug #13702433, Bug
#64188)

* X DevAPI: Client-side failover is now supported. It is
enabled by specifying multiple hosts in the X DevAPI
connection URL. See X DevAPI URL Format for more details.

* com.mysql.cj.core.MysqlType can now be used as
java.sql.SQLType in JDBC methods.

* X DevAPI: A new method, createTable(), has been added to
the Schema interface. See MySQL Connector/J X DevAPI
Reference (http://dev.mysql.com/doc/dev/connector-j/) for
details.

* X DevAPI: A new method, bindToDefaultShard(), has been
added to the XSession interface. It creates a “virtual”
NodeSession instance, which shares the connection to the
router with the XSession that was used to create it. See
MySQL Connector/J X DevAPI Reference
(http://dev.mysql.com/doc/dev/connector-j/) for details.

* X DevAPI: For any function that takes a value list of
parameters for its argument, there is now more
flexibility with how the parameters are to be specified:
they can now be supplied either as a value list or a list
of individual parameters.

* The Extension interface has been removed. Extension
classes now implement their own interfaces.

Bugs Fixed

* In certain cases, the exception interceptor was being
triggered twice in the internal SQLException factory
method. Also, if the exception interceptor returned an
exception with the cause already initialized, the same
factory method would fail to initialize the cause again,
and the real cause for the exception remained uncaptured.
(Bug #23743956)

* getLength() returned -1 for fields of the LONGBLOBL,
LONGTEXT, and GEOMETRY data types. This is due to the way
these data types are handled by protocol buffers, and
this fix makes the method return the right values. (Bug
#22988922)

* A memory leakage occurred when the connection properties
cachePrepStmts and useServerPrepStmts were both set to be
true and server-side prepared statements were set as
non-poolable, which resulted in the prepared statement
being not closable by the client, and the number of
prepared statements then kept on increasing.
When the memory leakage described above occurred, it did
not make Connector/J fail, as Connector/J switched to
using client-side prepared statements when the maximum
number of prepared statements was reached. However, when
rewriteBatchedStatements was also set to true, the switch
to client-side prepared statements did not occur, and
Connector/J threw the MySQLSyntaxErrorException (“Can’t
create more than max_prepared_stmt_count statements”)
when the client wanted to create more prepared statements
than allowed.
This fix corrected the way prepared statements are
handled in order to avoid both of the problems described
above. (Bug #22954007, Bug #80615)

* ResultSet.getString() sometimes returned garbled data for
columns of the JSON data type. This was because JSON data
was binary encoded by MySQL using the utf8mb4 character
set, but decoded by Connector/J using the ISO-8859-1
character set. This patch fixes the decoding for JSON
data. Thanks to Dong Song Ling for contributing to the
fix. (Bug #22891845, Bug #80631)

* When Connector/J retrieved the value of a BIT column as a
string using, for example, getString(), it returned the
wrong string if the BIT value happened to be equivalent
to the decimal value of some ASCII character. This was
because Connector/J treated the BIT value as a character
code; thus, for example, the value “01100001” (decimal 97
in binary) was interpreted as the character “a” (whose
ASCII value in decimal is 97), which was returned by the
function. This fix corrected the parsing behavior of
Connector/J on BIT values, so that a string
representation of the number (“97” in the last example)
is returned by getString(). (Bug #21938551, Bug #78685)

* When the connection property useLocalTransactionState was
set to “true” and autocommit was set to “false” on the
server, if any exception was thrown, any further calls
for rollback() or commit() were not sent to the server.
It was because when there was an exception while
executing a query, Connector/J lost the information
regarding the server’s transaction state. This patch
fixes this issue by preserving the previous transaction
state for the current connection when any exception is
thrown. (Bug #20212882, Bug #75209)

* An invalid connection URL caused Connector/J to throw a
NullPointerException. With this fix, an SQLException is
thrown instead in the situation. (Bug #18759269, Bug
#72632)

* When a very large amount of compressed data is
transmitted from the server to the client and under very
special circumstances, a CommunicationsException might
occur. It happened when a single compressed packet from
the server was not big enough to provide an entire
uncompressed packet to the client side. With this fix,
Connector/J reads as many compressed packets as necessary
to fill the size of the uncompressed packet that was
being requested. Thanks to Ryosuke Yamazaki for
contributing to the fix. (Bug #11756431, Bug #48346)

Documentation
————–
Online: http://dev.mysql.com/doc/connector-j/6.0/en/index.html

Reporting Bugs
—————
We welcome and appreciate your feedback and bug reports:
http://bugs.mysql.com/

On behalf of the MySQL Release Team
-Sreedhar S

MySQL Connector/Node.JS 1.0.4 now on npmjs.com

MySQL Connector/Node.JS 1.0.4 was recently released as a development milestone release. This is the first version available via npmjs.com. npmjs.com is the central registry for Node.JS packages. This and potential future official MySQL packages can be found using the @mysql organisation. For this to work we had to change the package name to contain that prefix and have chosen the name @mysql/xdevapi as this package provides the implementation of our X DevAPI for Node.JS and we have a free namespace for potential future libraries as part of our Connector/Node.JS product.

61

Given an existing Node.JS project we can easily install the library:

As presented with previous releases the implementation is built around Promises. After the installation it’s easy to ask for a session:

If the MySQL Server is running and the X Plugin was loaded this Promise object will resolve to a session, else it will be rejected.

As a new feature in 1.0.4 the connection parameters can also be provided in form of an URL. As the URL is defined in the X DevAPI it can be shared among applications using different languages and MySQL Connectors:

Another new feature in MySQL Connector/Node.JS is support for view DDL operations. To create a view a CRUD select object can be used:

In case the view isn’t needed anymore it can of course be dropped again:

For information purpose another addition are functions to gather row or document counts from tables or collections:

For the future there’s more to come. We’re working on different improvements to the API and performance. More on this in a later post.

MySQL Connector/Python 2.1.4 GA has been released

The MySQL Connector/Python Team is pleased to announce the newest MySQL Connector/Python 2.1.4, the second GA version of 2.1 release series of the pure Python database driver for MySQL.

This release includes a number of improvements for usability, stability and security.

Changes in MySQL Connector/Python 2.1.4 GA

Security Notes

The linked OpenSSL library for Connector/Python Commercial has been updated to version 1.0.1q. Issues fixed in the new OpenSSL version are described at http://www.openssl.org/news/vulnerabilities.html. This change does not affect Oracle-produced MySQL Community builds of Connector/Python, which use the yaSSL library instead.
The change also does not affect connections made using any pure Python implementation of Connector/Python, for which the version of OpenSSL used is whatever is installed on the system.

Bugs fixed

  • Connector/Python failed to establish connections using the cleartext client-side authentication plugin for accounts using the PAM server-side authentication plugin. Thanks to Daniël van Eeden for the patch. (Bug #22873551, Bug #80609)
  • A potential SQL injection vector was eliminated. (Bug #22529828)
  • Connections made using the C Extension failed when the ssl_ca parameter was given without ssl_cert and ssl_key. (Bug#21879914, Bug #79835, Bug #22494320)
  • For connections made with consume_results=True, consume_results was reset to False after callproc() execution failure. (Bug #21879859) References: This issue is a regression of: Bug #21492815.
  • In connections for which compress=True, LOAD DATA LOCAL INFILE statements produced “Packets out of error” errors. (Bug#21449996)
  • Attempts to insert Python ByteArray data into binary table columns failed. (Bug #77822, Bug #21498719)

Quick links

Documentation: http://dev.mysql.com/doc/connector-python/en/index.html
Release Notes: http://dev.mysql.com/doc/relnotes/connector-python/en/index.html
Downloads: http://dev.mysql.com/downloads/connector/python/#downloads
Feedback, bugs and feature requests: http://bugs.mysql.com
Forum: http://forums.mysql.com/list.php?50
On GitHub: https://github.com/oracle/mysql-connector-python

Thanks

Thank you all for your support and feedback!

On behalf of the MySQL Connector/Python Team.

MySQL for Visual Studio 2.0.4 has been released

The MySQL Windows Experience Team is proud to announce the release of MySQL for Visual Studio 2.0.4 m3. Note that this is a development preview release and not intended for production usage.

MySQL for Visual Studio 2.0.4 m3 is the third development preview release of the MySQL for Visual Studio 2.0 series.  This series adds support for the new X DevAPI. The X DevAPI enables application developers to write code that combines the strengths of the relational and document models using a modern, NoSQL-like syntax that does not assume previous experience writing traditional SQL.

To learn more about how to write applications using the X DevAPI, see http://dev.mysql.com/doc/x-devapi-userguide/en/. For more information about how the X DevAPI is implemented in MySQL for Visual Studio, and its usage, see http://dev.mysql.com/doc/refman/5.7/en/mysql-shell-visual-studio.html.

Please note that the X DevAPI requires at least MySQL Server version 5.7.12 or higher with the X Plugin enabled. For general documentation about how to get started using MySQL as a document store, see http://dev.mysql.com/doc/refman/5.7/en/document-store.html.

You can download MySQL Installer from our official Downloads page at http://dev.mysql.com/downloads/installer/.

MySQL for Visual Studio 2.0.4 m3 can also be downloaded by using the product standalone installer found at http://dev.mysql.com/downloads/windows/visualstudio/, under the tab “Development Releases”.

Changes in MySQL for Visual Studio 2.0.4 m3

What’s new in 2.0.4 m3

  • Enhanced the logic that migrates stored MySQL connections to the MySQL Workbench connections.xml file. In previous versions, the migration was offered and if not done at that moment, the dialog to migrate was shown every time the MySQL Connections Manager dialog was shown, but there was no way to choose to remain storing MySQL connections in the MySQL for Visual Studio configuration folder instead of merging them with MySQL Workbench.  Now, the connection migration dialog offers a way to postpone the migration by either 1 hour, 1 day, 1 week, 1       month or indefinitely. If the migration is postponed, the dialog is shown again after that time elapses. If it is postponed indefinitely, then an option is added to the MySQL Connections Manager dialog that permits the connection migration to be done manually, as long as MySQL Workbench is installed.
  • When the MySQL Script Editor window is opened (either by selecting SQL, JavaScript, or Python from the New MySQL Script menu), the Results area was visible showing a big gray area in the editor, despite having nothing to display. Now, this area is hidden until results are ready to display, which happens after clicking Run.
  • The SQL syntax parser was updated to handle the optimizer hints that were introduced in MySQL 5.7.7.
  • The SQL editor was updated to check the syntax of a script before sending the statements to the server. If syntax errors are present, the Visual Studio Output pane displays the errors and the script is not executed.
  • A drop-down list of connections was added in the MySQL editor toolbar to enable fast switching among connections while editing SQL, JavaScript, and Python scripts. The list, located next to the Connect to MySQL button, shows all Server Explorer connections for the MySQL data provider with compatible protocol       support.  Note JavaScript and Python editors show only the connections that support the X Protocol.

Bugs Fixed

  • MySQL Workbench was unable to open connections added from the MySQL Connection Manager, as executing them would emit the following error: “Cannot connect to Database Server”. This is because an invalid “socket=.” value was added to the connection definition. To solve this, MySQL for Visual Studio was updated to use the latest MySQL.Utility version, which fixes code in the MySQL Workbench class to only write the socket value into the XML nodes if the connection is of type Sockets or Pipe.
    • Bug #24666952
  • After connections were added to the Server Explorer through the MySQL Connections Manager, clicking Refresh on the Server Explorer toolbar caused the refresh operation to hang, and nothing else could be done within the Server Explorer pane. Clicking Cancel Refresh was required to fix this.
    • Bug #24666931
  • SHOW statements executed from the SQL editor failed to display the expected output.
    • Bug #24622881
  • Queries executed from the SQL editor against nonunique data in NoSQL tables emitted error messages and failed to return result sets.
    • Bug #24462707
  • The main XML element in %APPDATA%\Oracle\MySQL For Visual Studio\settings.config was renamed to MySQLforVisualStudio from MySQLForExcel. Indentations were added to improve the overall readability of configuration settings.
    • Bug #24291264
  • JavaScript and Python editors permitted connections to versions of MySQL that did not support the X Protocol if those connections were unnamed or temporary, but the scripts did not work properly. This fix adds validation to ensure that all connections related to JavaScript and Python scripts are to servers with the X Plugin enabled.
    • Bug #24290570
  • Selecting the New MySQL Script context-menu option by right-clicking a Server Explorer connection in Visual Studio emitted an error if the connection was first closed and then opened.
    • Bug #24064816
  • Visual Studio was unable to open a design window for any selected table in a MySQL database.
    • Bug #23642010
  • Opening a new MySQL script file from the Visual Studio File > New menu displayed the following error: “Object reference not set to an instance of an object”.
    • Bug #23619311
  • Processing a Result object from the X Protocol substituted an error or information message in place of some collection output.
    • Bug #22983803
  • Advanced, Connect, and Cancel buttons were missing from the Connect to MySQL dialog for connections made from the script editor window.
    • Bug #22114315
  • Dragging and dropping a table from the Server Explorer in Visual Studio to a project would fail with the following error: “Some updating commands could not be generated automatically. The database returned the following error: You have a usable connection already”. After clicking OK, Visual Studio would emit the following error “Mouse drag operation failed. Could not retrieve schema information from table or view”. To solve this issue, MySql.Data was updated to version 6.9.9.
  • From the Query Designer, selecting Verify SQL Syntax would always display “Not supported by the provider” instead of verifying the SQL syntax.
  • The Python code editor displayed session options for JavaScript instead of options for the Python language.
  • In some cases, selecting Retrieve Data for a table with a valid connection failed to populate the table with data.

Quick links

Enjoy and thanks for the support!

MySQL for Visual Studio Team.