MySQL Connector/NET provider for Entity Framework Core 3.1

Hello MySQL Connector/NET community,

Keeping an ongoing pace to support the latest technologies, we are pleased to announce the latest updates regarding MySQL Connector/NET and Entity Framework Core.

As you may know, Entity Framework Core 3.1 is the latest and long-term support (LTS) release, meaning that it will be supported for at least 3 years. It has a primary goal to polish the EF Core 3.0 version and reintroduces support for .NET Standard 2.0, so it will run on .NET Frameworks versions that support the standard. In our continuous effort to keep up on the latest technologies, we would like to share with you that our latest GA release, Connector/NET 8.0.20, comes with full support for EF Core 3.1.

Let’s have a short demonstration on how to use Connector/NET and EF Core. We are going to use the Code First process to create the database in our server and build up our Entity Model in a Console Application.

Prerequisites:
– Visual Studio 2019
.NET Core 3.1 SDK
MySQL Server
– Connector/NET 8.0.20 (this could be obtained on our site or by using NuGet)

We are going to start by creating a console application and in this case, we are going to do it by using .NET Core CLI:

dotnet new console -o EFCoreSample

If we look into the .csproj file of our application, we can see that the TargetFramework have been set to netcoreapp3.1. Then we need to add our EF Core Connector/NET NuGet package to the project:

dotnet add package MySql.Data.EntityFrameworkCore –-version
8.0.20

So now that we have our console application and the EF Core Connector/NET package installed, we can start writing our context and entity classes. Create a class called Model.cs in the project directory with the following code:

using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using MySql.Data.EntityFrameworkCore.DataAnnotations;

namespace EFCoreSample
{
  public class LibraryContext : DbContext
  {
    public DbSet<Book> Book { get; set; }
    public DbSet<Publisher> Publisher { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder options)
        => options.UseMySQL("server=localhost;database=efcoresample;user=efcore;password=");

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
      base.OnModelCreating(modelBuilder);

      modelBuilder.Entity<Publisher>(entity =>
      {
        entity.HasKey(e => e.ID);
        entity.Property(e => e.Name).IsRequired();
      });

      modelBuilder.Entity<Book>(entity =>
      {
        entity.HasKey(e => e.ISBN);
        entity.Property(e => e.Title).IsRequired();
        entity.HasOne(d => d.Publisher)
          .WithMany(p => p.Books);
      });
    }
  }

  [MySqlCollation("latin1_spanish_ci")]
  public class Book
  {
    [MySqlCharset("latin1")]
    public string ISBN { get; set; }

    public string Title { get; set; }
    public string Author { get; set; }
    public string Language { get; set; }
    public int Pages { get; set; }
    public virtual Publisher Publisher { get; set; }
  }

  public class Publisher
  {
    public int ID { get; set; }
    public string Name { get; set; }
    public virtual ICollection<Book> Books { get; set; }
  }
}

Now that we have our context and entity classes set up, we can start using our model the way we want to, in this example we are going to insert a couple of records and then print them in screen. On the main class of our project (Program.cs) we are going to add two methods, one to insert data and another to print it:

using System;
using System.Text;
using Microsoft.EntityFrameworkCore;

namespace EFCoreSample
{
  class Program
  {
    static void Main(string[] args)
    {
      InsertData();
      PrintData();
      Console.ReadKey();
    }

    private static void InsertData()
    {
      using (var context = new LibraryContext())
      {
        // Creates the database if not exists
        context.Database.EnsureCreated();

        // Adds a publisher
        var publisher = new Publisher
        {
          Name = "Mariner Books"
        };
        context.Publisher.Add(publisher);

        // Adds some books
        context.Book.Add(new Book
        {
          ISBN = "978-0544003415",
          Title = "The Lord of the Rings",
          Author = "J.R.R. Tolkien",
          Language = "English",
          Pages = 1216,
          Publisher = publisher
        });
        context.Book.Add(new Book
        {
          ISBN = "978-0547247762",
          Title = "The Sealed Letter",
          Author = "Emma Donoghue",
          Language = "English",
          Pages = 416,
          Publisher = publisher
        });

        // Saves changes
        context.SaveChanges();
      }
    }

    private static void PrintData()
    {
      // Gets and prints all books in database
      using (var context = new LibraryContext())
      {
        var books = context.Book.Include(p => p.Publisher);
        foreach (var book in books)
        {
          var data = new StringBuilder();
          data.AppendLine($"ISBN: {book.ISBN}");
          data.AppendLine($"Title: {book.Title}");
          data.AppendLine($"Publisher: {book.Publisher.Name}");
          Console.WriteLine(data.ToString());
        }
      }
    }
  }
}

And that’s it! A quick look on how to build an EF Core 3.1 application using MySQL Connector/NET as the provider. This is just a small demonstration of what ypu can do with EF Core. There are many features in EF Core to use and we are pleased to tell you that Connector/NET has full support for them.

We hope you find this information useful to start using MySQL Connector/NET with the most recent technologies. Your feedback is always welcome and all your comments inspire us to keep improving so that we offer you a product with top quality.

Finally, here are some links that could be useful for you:

We hope to hear from you!

MySQL Connector/J 5.1.49 GA has been released

Dear MySQL Users,

MySQL Connector/J 5.1.49, a maintenance release of the production 5.1
branch, has been released. Connector/J is the Type-IV pure-Java JDBC
driver for MySQL.

MySQL Connector/J is available in source and binary form from the
Connector/J download pages at
http://dev.mysql.com/downloads/connector/j/5.1.html
and mirror sites as well as Maven repositories.

MySQL Connector/J (Commercial) is available for download on the My Oracle
Support (MOS) website. This release will shortly be available on
eDelivery (OSDC).

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.

MySQL Connector/J 5.1.49 includes the following general bug fixes and
improvements, also available in more detail on
https://dev.mysql.com/doc/relnotes/connector-j/5.1/en/news-5-1-49.html

Changes in MySQL Connector/J 5.1.49 (2020-04-29, General
Availability)

   Version 5.1.49 is a maintenance release of the production 5.1
   branch. It is suitable for use with MySQL Server versions
   5.6, 5.7, and 8.0. It supports the Java Database Connectivity
   (JDBC) 4.2 API.

     * Functionality Added or Changed

     * Bugs Fixed

Functionality Added or Changed

     * Default value of the connection property
       allowLoadLocalInfile has been changed to false.
       Applications that use the LOAD DATA LOCAL INFILE
       (https://dev.mysql.com/doc/refman/8.0/en/load-data.html)
       statement on MySQL Servers need to set this property to
       true explicitly. (Bug #29261254, Bug #30866178)

     * The allowable versions of TLS protocol used for
       connecting to the server, when no restrictions have been
       set using the connection properties enabledTLSProtocols,
       have been changed to:

          + TLSv1, TLSv1.1, and TLSv1.2 for MySQL Community
            Servers 8.0, 5.7.28 and later, and 5.6.46 and later,
            and for commercial versions of MySQL Server 5.6,
            5.7, and 8.0.

          + TLSv1 and TLSv1.1 for all other versions of MySQL
            Servers.

     * The following third-party libraries have been removed
       from the distribution bundles for Connector/J:

          + C3P0 (required for building Connector/J from source)

          + JBoss common JDBC wrapper (required for building
            Connector/J from source)

          + Simple Logging Facade API (required for using the
            logging capabilities provided by the default
            implementation of org.slf4j.Logger.Slf4JLogger by
            Connector/J, and for building Connector/J from
            source)
       Users who need those libraries have to obtain them on
       their own. See Installing Connector/J from a Binary
       Distribution
(https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-binary-installation.html)
       and Installing from Source
(https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-installing-source.html)
       for details.

Bugs Fixed


     * When trying to set a parameter for a PreparedStatement
       using the method
       PreparedStatement.setObject(parameterIndex, “false”,
       Types.BOOLEAN), the value was set to true instead of
       false. (Bug #30911870, Bug #98237)

     * In line with good XML practices, DTD processing has been
       disabled for Connector/J’s MySQL Fabric XML parser. (Bug
       #30657312)

     * Methods of the ResultSetUtil class that are no longer
       used in Connector/J 5.1 have been removed. (Bug
       #30636056)

     * For some prepared statements, calling getMetaData() on
       them resulted in an Incorrect DATE error, even when no
       DATE values were involved. This was due to some recent
       changes on the MySQL Server, to which this patch adjusts
       Connector/J. (Bug #30151808, Bug #96442)
       References: See also: Bug #29025656, Bug #28940878.

     * When working with a load balancing setup, if the
       connection property loadBalanceStrategy was set to
       bestResponseTime and connections to all the hosts in the
       original setup failed, Connector/J hung, even if there
       were actually newly-added hosts available. This was
       because Connector/J mishandled the host whitelist, and
       this patch corrects the problem. (Bug #23143279)

     * Inserting values in batch using a PreparedStatement
       failed for an INSERT …VALUE
       (https://dev.mysql.com/doc/refman/8.0/en/insert.html)
       statement but worked for an INSERT … VALUES
       (https://dev.mysql.com/doc/refman/8.0/en/insert.html)
       statement, while they are synonymous for MySQL. (Bug
       #21181501, Bug #77183)


On Behalf of Oracle/MySQL Release Engineering Team,
Sreedhar S

MySQL Connector/Python 8.0.20 has been released

Dear MySQL users,

MySQL Connector/Python 8.0.20 is the latest GA release version of the
MySQL Connector Python 8.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/

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 8.0
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/8.0/en/document-store.html

To download MySQL Connector/Python 8.0.20, see the “General Availability
(GA) Releases” tab at

  http://dev.mysql.com/downloads/connector/python/

Enjoy!

==============================================================================

Changes in MySQL Connector/Python 8.0.20 (2020-04-27, General Availability)

Functionality Added or Changed

 * For X DevAPI applications, when creating a new
   connection, if the connection data contains several
   target hosts that have no explicit priority assigned, the
   behavior of the failover logic now is the same as if all
   those target hosts have the same priority. That is, the
   next candidate for making a connection is chosen randomly
   from the remaining available hosts. Alternatively, the
   new priority attribute optionally sets the priority for
   each host. If two hosts have the same priority then one
   is chosen at random.

Bugs Fixed

 * The fetchmany() method failed to function properly when
   the last fetch was not a full batch; and would hang.
   Thanks to Bruce Feng for the patch.
   (Bug#30608703, Bug#97830)

On Behalf of Oracle/MySQL Engineering Team
Kent Boortz

MySQL Connector/C++ 8.0.20 has been released

Dear MySQL users,

MySQL Connector/C++ 8.0.20 is a new release version of the MySQL
Connector/C++ 8.0 series.

Connector/C++ 8.0 can be used to access MySQL implementing Document
Store or in a traditional way, using SQL queries. It allows writing
both C++ and plain C applications using X DevAPI and X DevAPI for C.
It also supports the legacy API of Connector/C++ 1.1 based on JDBC4.

To learn more about how to write applications using X DevAPI, see
“X DevAPI User Guide” at

https://dev.mysql.com/doc/x-devapi-userguide/en/

See also “X DevAPI Reference” at

https://dev.mysql.com/doc/dev/connector-cpp/devapi_ref.html

and “X DevAPI for C Reference” at

https://dev.mysql.com/doc/dev/connector-cpp/xapi_ref.html

For generic information on using Connector/C++ 8.0, see

https://dev.mysql.com/doc/dev/connector-cpp/

For general documentation about how to get started using MySQL
as a document store, see

http://dev.mysql.com/doc/refman/8.0/en/document-store.html

To download MySQL Connector/C++ 8.0.20, see the “General Availability (GA)
Releases” tab at

https://dev.mysql.com/downloads/connector/cpp/

Changes in MySQL Connector/C++ 8.0.20 (2020-04-27, General Availability)

Connection Management Notes

     * For connections made using X Plugin, Connector/C++ now
       provides control over the use of compression to minimize
       the number of bytes sent over connections to the server.
       Connection URIs and SessionSettings objects permit
       explicitly specifying a compression option:

          + URI strings permit a compression option with
            permitted values of DISABLED, PREFERRED, and
            REQUIRED (not case-sensitive). Examples:
            mysqlx://user:password@host:port/db?compression=DISABLED
            mysqlx://user:password@host:port/db?compression=PREFERRED
            mysqlx://user:password@host:port/db?compression=REQUIRED

          + SessionSettings object permit a
            SessionOption::COMPRESSION option with permitted
            values of CompressionMode::DISABLED,
            CompressionMode::PREFERRED, and
            CompressionMode::REQUIRED. Example:
            mysqlx::Session sess(SessionOption::PORT, “user_name”,
                                 SessionOption::USER, “password”,
                                 SessionOption::COMPRESSION,
                                 CompressionMode::PREFERRED);

       These rules apply:

          + If compression is disabled, the connection is
            uncompressed.

          + If compression is preferred, Connector/C++
            negotiates with the server to find a compression
            algorithm supported in common on the server and
            client sides. If no common algorithm is available,
            the connection is uncompressed.

          + If compression is required, compression algorithm
            negotiation occurs as with compression preferred. If
            no common algorithm is available, the connection
            terminates with an error.
       To avoid CPU inefficiency, data packets are not
       compressed even when compression is enabled unless they
       exceed a threshold size (currently 1000 bytes; this is
       subject to change).
       See also Connection Compression with X Plugin
       (https://dev.mysql.com/doc/refman/8.0/en/x-plugin-connection-compression.html).


Packaging Notes

     * Previously, Connector/C++ binary distributions were
       compatible with projects built using MSVC 2019 (using
       either dynamic or static connector libraries) or MSVC
       2017 (using dynamic connector libraries only). Binary
       distributions now are also compatible with MSVC 2017
       using the static X DevAPI connector library. This means
       that binary distributions are fully compatible with MSVC
       2019, and fully compatible with MSVC 2017 with the
       exception of the static legacy (JDBC) connector library.


Bugs Fixed

     * For connections made using X Plugin, the last byte was
       removed from DATETIME values fetched as raw bytes. (Bug
       #30838230)

     * In X DevAPI expressions, Connector/C++ treated the JSON
       ->> operator the same as ->, rather than applying an
       additional JSON_UNQUOTE() operation. (Bug #29870832)

     * Comparison of JSON values from query results failed due
       to an extra \0 character erroneously being added to the
       end of such values. (Bug #29847865)

     * For connections made using X Plugin, warnings sent
       following result sets were not captured, and were thus
       unavailable to getWarnings(). (Bug #28047970)

On Behalf of Oracle/MySQL Release Engineering Team,
Hery Ramilison

MySQL Connector/ODBC 8.0.20 has been released

Dear MySQL users,

MySQL Connector/ODBC 8.0.20 is a new version in the MySQL Connector/ODBC
8.0 series, the ODBC driver for the MySQL Server.

The available downloads include both a Unicode driver and an ANSI driver
based on the same modern codebase. Please select the driver type you
need based on the type of your application – Unicode or ANSI.
Server-side prepared statements are enabled by default. It is suitable
for use with the latest MySQL server version 8.0.

This release of the MySQL ODBC driver is conforming to the ODBC 3.8
specification. It contains implementations of key 3.8 features,
including self-identification as a ODBC 3.8 driver, streaming of out for
binary types only), and support of the SQL_ATTR_RESET_CONNECTION
connection attribute (for the Unicode driver only).

The release is now available in source and binary form for a number of
platforms from our download pages at

https://dev.mysql.com/downloads/connector/odbc/

For information on installing, please see the documentation at

https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-installation.html

Enjoy and thanks for the support!

================================================================

Changes in MySQL Connector/ODBC 8.0.20 (2020-04-27, General Availability)

  • Functionality Added or Changed
  • Bugs Fixed

Functionality Added or Changed

  • On Debian, DEB packages are now released instead of TGZ
    files. The file base names are mysql-connector-odbc-*
    (driver package) and mysql-connector-odbc-setup (setup
    package). The setup package contains the GUI
    configuration widget library (libmyodbc8S.so) and depends
    on the driver package. The driver package depends on the
    unixODBC libraries (libodbc, libodbcinst); and does not
    conflict with the official Debian package (libmyoodbc).

Bugs Fixed

  • When using SQL_C_WCHAR with SQLGetData, binary data was
    not returned correctly as its hexacecimal representation.
    Related, using SQL_C_CHAR with SQLGetData did return
    binary data as hex. (Bug #28864788, Bug #92429)
  • When binding an SQL_BIT type column to the SQL_C_CHAR
    type, SQLFetchScroll would return the values as an
    integer instead of a char. (Bug #28484784, Bug #91904)

On Behalf of Oracle/MySQL Engineering Team
Prashant Tekriwal

MySQL Connector/Node.js 8.0.20 has been released

Dear MySQL users,

MySQL Connector/Node.js is a new Node.js driver for use with the X
DevAPI. This release, version 8.0.20, is a maintenance release of the
MySQL Connector/Node.js 8.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.

MySQL Connector/Node.js can be downloaded through npm (see
https://www.npmjs.com/package/@mysql/xdevapi for details) or from
https://dev.mysql.com/downloads/connector/nodejs/.

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
Connector/Node.js, and its usage, see
http://dev.mysql.com/doc/dev/connector-nodejs/.

Please note that the X DevAPI requires at least MySQL Server version
8.0 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/8.0/en/document-store.html.

Changes in MySQL Connector/Node.js 8.0.20 (2020-04-27, General Availability)

Functionality Added or Changed

     * Added two new connection options that evaluate during the
       TLS handshake to restrict the negotiated TLS protocols
       and ciphers; along with those configured on the server
       that can further restrict the final choices. These new
       options are tls-versions to define the allowed TLS
       protocol versions, and tls-ciphersuites for the allowed
       cipher suites. These definitions are comma-separated, and
       accepted by the getSession() and getClient() methods.
       tls-versions: accepts one or more of the following:
       TLSv1, TLSv1.1, TLSv1.2, and TLSv1.3. Other values
       generate an error.
       tls-ciphersuites: accepts IANA cipher suite names, as
       listed on IANA’s TLS Cipher Suites
(https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-4)
       page. Unsupported or unknown values are ignored.
       Example usage demonstrating both plain JavaScript and
       JSON configuration object formats:
# tls versions:
mysqlx.getSession(‘mysqlx://root@localhost?tls-versions=[TLSv1,TLSv1.1
,TLSv1.2,TLSv1.3]’)

mysqlx.getSession({ user: ‘root’, tls: { versions: [‘TLSv1’, ‘TLSv1.1’
, ‘TLSv1.2’, ‘TLSv1.3’] } })

# tls ciphersuites
mysqlx.getSession(‘mysqlx://root@localhost?tls-ciphersuites=[DHE-RSA-A
ES128-GCM-SHA256,DHE-RSA-AES256-SHA256]’)

mysqlx.getSession({ user: ‘root’, tls: { ciphersuites: [‘DHE-RSA-AES12
8-GCM-SHA256′, ‘DHE-RSA-AES256-SHA256’] } })

     * For X DevAPI applications, when creating a new
       connection, if the connection data contains several
       target hosts that have no explicit priority assigned, the
       behavior of the failover logic now is the same as if all
       those target hosts have the same priority. That is, the
       next candidate for making a connection is chosen randomly
       from the remaining available hosts. If two hosts have the
       same priority then one is chosen at random.

On Behalf of MySQL/ORACLE RE Team
Gipson Pulla

MySQL Connector/J 8.0.20 has been released

Dear MySQL users,

MySQL Connector/J 8.0.20 is the latest General Availability release of
the MySQL Connector/J 8.0 series.  It is suitable for use with MySQL
Server versions 8.0, 5.7, and 5.6.  It supports the Java Database
Connectivity (JDBC) 4.2 API, and implements the X DevAPI.

This release includes the following new features and changes, also
described in more detail on

https://dev.mysql.com/doc/relnotes/connector-j/8.0/en/news-8-0-20.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 8.0.20 GA, see the “General Availability
(GA) Releases” tab at http://dev.mysql.com/downloads/connector/j/

Enjoy!

Changes in MySQL Connector/J 8.0.20 (2020-04-27, General Availability)

* Functionality Added or Changed

* Bugs Fixed

Functionality Added or Changed

* X DevAPI: Connector/J now supports data compression for X Protocol
connections (https://dev.mysql.com/doc/refman/8.0/en/x-plugin-connection- compression.html). See Connection Compression Using X DevAPI (https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-connection-compression-xdevapi.html) for details.

* A new method, getElapsedTime(), has been added to
Connector/J ‘s implementation of the Statement interface,
to expose the elapsed time for a query. Thanks to Matti
Sillanpää for contributing the code. (Bug #30570249, Bug
#97714)

Bugs Fixed

* When a custom Calendar was used in the setDate method for
a PreparedStatement, it was being used by subsequent
calls of the same method that did not use the same
calendar, resulting in the wrong date being set. It was
because the SimpleDateFormat object created internally
with the custom calendar was cached and reused. With this
fix, the object is no longer cached. (Bug #30877755)

* Setting the connection property clientInfoProvider
without using the fully qualified class name for
ClientInfoProviderSP caused a NullPointerException. This
was due to some wrong exception handling, which has been
corrected by this fix. (Bug #30832513)

* Authentication failed when a client tried to connect to a
server that used Windows Authentication Plugin and the
Kerberos protocol. It was because the implementation of
the NativeAuthenticationProvider class by Connector/J did
not interact correctly with a custom-made Kerberos
authentication plugin, and this patch fixes the issue.
(Bug #30805426)

* Methods from the ResultSetUtil class are no longer used
in Connector/J 8.0.20; the class has therefore been
removed. (Bug #30636056)

* A NullPointerException was returned when the connection
had cacheResultSetMetadata=true and a query containing
any SET statements was executed. This fix corrects the
issue by adding the missing variable assignment, and also
a null check. (Bug #30584907, Bug #97757)

* A DataConversionException was thrown when an application
tried to store a string starting with “d.” [d was any
digit] into a VARCHAR column. It was due to a parsing
error in the AbstractNumericValueFactory, which has been
fixed by this patch. Thanks to Nick Pollett for
contributing the code. (Bug #30570721, Bug #97724)

* When creating a Statement, the specification for the
resultSetType parameter was not honored, so that the
ResultSet type was always set to
ResultSet.TYPE_FORWARD_ONLY. With this fix, the
resultSetType parameter is now honored. Also, type
validation has been added so that calling the methods
beforeFirst, afterLast, first, last, absolute, relative,
or previous results in an exception if the ResultSet type
is ResultSet.TYPE_FORWARD_ONLY. (Bug #30474158)

* When a Calendar was not used, a java.sql.Date value could
not always be stored into and then retrieved from a MySQL
server consistently. It was because Connector/J always
converted a Date value to the server’s time zone when
storing it on the server as a MySQL DATE; but since a
MySQL DATE does not have any time value, the hour,
minute, and second parts of the original date was
effectively lost. If the converted value is one day ahead
of or behind the original value, when the value was
retrieved through Connector/J and converted back to the
local time zone, there was no time value for adjusting
the date back to its original value, resulting in a
one-day error. With this fix, any Date value is converted
to MySQL DATE value using the JVM’s time zone, so that
the value is always consistent when being stored and then
read back.
Also, the cacheDefaultTimezone connection property,
previously removed from Connector/J 8.0, has now been
restored so that when it is set to false, Connector/J
becomes aware of the time zone changes of the JVM during
runtime and converts dates with the updated time zone.
(Bug #28125069, Bug #91112)

On Behalf of MySQL Release Engineering Team,
Surabhi Bhat

Rethinking Result Sets in Connector/Node.js

It used to be the case where, in order to actually process data retrieved from the database using Connector/Node.js, you would have to resort to an API that required the use of both JavaScript callbacks and Promises. This was meant to provide more flexibility and control to the application developer and at the same time decrease the chance of buffering data unnecessarily. However this wasn’t useful for 99% of the use-cases and made simple tasks a little bit cumbersome. Also, the fact that it required using two different asynchronous constructs made it a little bit harder to grasp.

To make matters worse, in order to consume operational metadata about the columns in the result set, you would have to provide an additional callback, making the whole thing spiral a bit out of control, particularly when there were multiple result sets involved. In that case, you needed to create a shared context between the two functions in order to map data and metadata for each column in each result set.

Continue reading

MySQL Connector/Node.js 8.0.19 has been released

Dear MySQL users,

MySQL Connector/Node.js is a new Node.js driver for use with the X
DevAPI. This release, v8.0.19, is a maintenance release of the
MySQL Connector/Node.js 8.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.

MySQL Connector/Node.js can be downloaded through npm (see
https://www.npmjs.com/package/@mysql/xdevapi for details) or from
https://dev.mysql.com/downloads/connector/nodejs/.

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
Connector/Node.js, and its usage, see
http://dev.mysql.com/doc/dev/connector-nodejs/.

Please note that the X DevAPI requires at least MySQL Server version
8.0 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/8.0/en/document-store.html.

Changes in MySQL Connector/Node.js 8.0.19 (2020-01-13, General Availability)

Functionality Added or Changed

  • Added DNS SRV support.
    Using the mysqlx+srv scheme+extension in a connection
    string (or enabling the resolveSrv option in a connection
    configuration object) allows to automatically resolve any
    SRV record available in a target DNS server or service
    discovery endpoint.

Bugs Fixed

  • Improved the CRUD API error messages. (Bug #30423556)
  • The getAffectedItemsCount() method did not function on
    result sets in v8.0.18. (Bug #30401962)
  • The Collection.existsInDatabase() method did not
    function. (Bug #30401432)

On Behalf of MySQL/ORACLE RE Team
Gipson Pulla

MySQL Connector/J 8.0.19 has been released

Dear MySQL users,

MySQL Connector/J 8.0.19 is the latest General Availability release of
the MySQL Connector/J 8.0 series.  It is suitable for use with MySQL
Server versions 8.0, 5.7, and 5.6.  It supports the Java Database
Connectivity (JDBC) 4.2 API, and implements the X DevAPI.

This release includes the following new features and changes, also
described in more detail on

https://dev.mysql.com/doc/relnotes/connector-j/8.0/en/news-8-0-19.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 8.0.19 GA, see the “General Availability
(GA) Releases” tab at http://dev.mysql.com/downloads/connector/j/

Enjoy!

Changes in MySQL Connector/J 8.0.19 (2020-01-13, General Availability)

Functionality Added or Changed


     * Connector/J now supports the use of DNS SRV records for
       connections.  Here is a brief summary for Connector/J’s support
       for DNS SRV records:

          + These new schemas in the connection URLs enable DNS
            SRV support:
               o jdbc:mysql+srv: For ordinary and basic failover
                 JDBC connections that make use of DNS SRV
                 records.
               o jdbc:mysql+srv:loadbalance: For load-balancing
                 JDBC connections that make use of DNS SRV
                 records.
               o jdbc:mysql+srv:replication: For replication
                 JDBC connections that make use of DNS SRV
                 records.
               o mysqlx+srv: For X DevAPI connections that make
                 use of DNS SRV records.

          + Besides using the new schemas in the connection
            URLs, DNS SRV record support can also be enabled or
            disabled using the two new connection properties,
            dnsSrv and xdevapi.dns-srv, for JDBC and X DevAPI
            connections respectively.
       See Support for DNS SRV Records
(https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-dns-srv.html)
       in the Connector/J 8.0 Developer Guide
(https://dev.mysql.com/doc/connector-j/8.0/en/) for
       details.

     * X DevAPI: The server failover support for connections
       using X DevAPI has been enhanced with the following features:

          + When the priority property is NOT set for each host
            in the connection URL, failover connections are
            attempted on the hosts in a random order, until a
            connection is successfully established (Connector/J
            used to attempt connections to the hosts in the
            sequence they appear in the connection URL).

          + Once all hosts have been tried and no connections
            can be made, Connector/J throws a
            com.mysql.cj.exceptions.CJCommunicationsException
            and returns the message Unable to connect to any of
            the target hosts.

          + When using connection pooling, Connector/J keeps
            track of any host it failed to connect to and, for a
            short waiting period after the failure, avoids
            connecting to it during the creation or retrieval of
            a Session. However, if all other hosts have already
            been tried, those excluded hosts will be retried
            without waiting. Once all hosts have been tried and
            no connections can be established, Connector/J
            throws a
            com.mysql.cj.exceptions.CJCommunicationsException
            and returns the message Unable to connect to any of
            the target hosts.

     * X DevAPI: The allowed TLS versions and cipher suites for
       X DevAPI connections can now be restricted by two new
       connection properties:

          + xdevapi.tls-versions restricts the allowable TLS
            protocol versions to be used for X DevAPI
            connections.

          + xdevapi.tls-ciphersuites restricts the allowable
            cipher suites to be used for X DevAPI connections.
       See the descriptions for them in Configuration Properties
(https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-configuration-properties.html)
       and also Connecting Securely Using SSL
(https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-using-ssl.html)
       for details.

     * MySQL Server 8.0.17 deprecated the display width for the
       TINYINT, SMALLINT, MEDIUMINT, INT, and BIGINT data types when the
       ZEROFILL modifier is not used, and MySQL Server 8.0.19 has
       removed the display width for those data types from results of
       SHOW CREATE TABLE, SHOW CREATE FUNCTION, and queries on
       INFORMATION_SCHEMA.COLUMNS, INFORMATION_SCHEMA.ROUTINES, and
       INFORMATION_SCHEMA.PARAMETERS (except for the display width for
       signed TINYINT(1)). This patch adjusts Connector/J to those
       recent changes of MySQL Server and, as a result,
       DatabaseMetaData, ParameterMetaData, and ResultSetMetaData now
       report identical results for all the above-mentioned integer
       types and also for the FLOAT and DOUBLE data types.
       (Bug #30477722)

     * The cipher suites usable by Connector/J are now
       pre-restricted by a properties file that can be found at
       src/main/resources/com/mysql/cj/TlsSettings.properties inside the
       src folder on the source tree or in the platform-independent
       distribution archive (in .tar.gz or .zip format) for Connector/J.
       See Connecting Securely Using SSL
(https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-using-ssl.html)
       for details.

     * The allowable versions of TLS protocol used for
       connecting to the server, when no restrictions have been set
       using the connection properties enabledTLSProtocols, have been
       changed to:

          + TLSv1, TLSv1.1, TLSv1.2, and TLSv1.3 for MySQL
            Community Servers 8.0, 5.7.28 and later, and 5.6.46
            and later, and for all commercial versions of MySQL
            Servers.

          + TLSv1 and TLSv1.1 for all other versions of MySQL
            Servers.

Bugs Fixed


     * The RPM package for Connection/J provided by the MySQL
       Yum repository did not have its epoch set; as a result, the
       package could not be installed on an Enterprise Linux or Fedora
       system even if the MySQL Yum repository has been enabled, because
       the Connector/J package in the native repository had the epoch
       set to 1. This fix sets the epoch also to 1 for the RPM package
       provided by the MySQL Yum repository, in order to prevent the
       installation problem. (Bug #30566384, Bug #97700)

     * For some prepared statements, calling getMetaData() on
       them resulted in an Incorrect DATE error, even when no DATE
       values were involved. This was due to some recent changes on the
       MySQL 8.0 Server, to which this patch adjusts Connector/J. (Bug
       #30151808, Bug #96442) References: See also: Bug #29025656,
       Bug #28940878.

     * When retrieving TIME values using
       ResultSet.getTimestamp(), the fractional seconds are truncated
       when useCursorFetch=true. This patch corrects the problem by
       fixing the TIME value decoding in the MysqlBinaryValueDecoder. It
       also corrects some inconsistencies in formatting the fractional
       seconds when returning the TIME values as strings.
       (Bug #30119545, Bug #96383)

     * Streaming of multiple result sets failed with an error.
       It was due to an error in switching the streamer source from one
       result set to another, and this fix corrects the issue.
       (Bug #29999318, Bug #96059)

Enjoy and thanks for the support!

On behalf of the MySQL Release Team,
Nawaz Nazeer Ahamed