Connector/J moves to Git

I’m pleased to announce that Connector/J has a new home.

Just as several other MySQL products, Connector/J source code management moved to Git and, pretty much as expected, to GitHub. Our reasoning is nothing else than listening to our users demands and trying to follow best trends and practices. There was nothing significantly wrong with Bazaar and Launchpad, as they served us well for the last seven years. It was just time to move on.

Rest assured, all will work as before, no complications no hassles. Our public GitHub repository will expose Connector/J source code as it is in the latest generally available (GA) release, as it has been for the last years.

From now on you will find Connector/J source code in the well known Git repository hosting service, GitHub, at mysql-connector-j under the umbrella of MySQL organization. Other MySQL products will follow in time. This repository contains all history since Connector/J early days so nothing was lost. Those who are used to our old launchpad repository will only have to change tools.

Hands-on

GitHub allows you to explore source code, project history, get to know about contributions and a lot more. But you probably already know all of this anyway.

So, to get the Connector/J source code you can just execute the following command in your preferred shell or command prompt:

You can also fetch the code through SSH protocol, using Subversion or simply download it as a zip file. Obviously, in order for you to execute git commands, you’ll have to have it installed in your computer. Just follow the official getting started guide if you don’t have it yet.

Building MySQL Connector/J 5.1 from source

Some time ago I have blogged about building Connector/J from source code. Nothing changes in this post, except for the replacement of Bazaar and Launchpad by Git and GitHub respectively and the  bzr  command that is replaced by the  git  command mentioned above.

We love to hear from you

As always, don’t forget to use our official channels to report us your wishes, findings or just ask for help when you need it. We can be found at MySQL Bugs database or MySQL Connector/JDBC and Java forum. Thank you!

Welcome to Connector/J on Git!
Farewell Bazaar. Farewell Launchpad. Thank you for the 7 years of good services.

How to use MySQL for your ASP.NET Identity provider with a custom primary key

Image

One of the most important things in any application is having a good and well back up security mechanism that ensures the access to the site or application is well managed and controlled.

With the ASP.NET Identity provider you have a balance between customization and a good separation between the storage of the identity information and the code that implements the security system. This separation allows to have a very good customization in terms of the information that the application will store from each one of the users and roles. (more information and context here)

Here are some important features within the ASP.NET Identity provider

  • A higher level of customization of the data associated with the user account.
    Developers have the facility to add or change the data stored of the user by implementing the IUser interface. All the data will be stored by doing the implementation of the IUserStore interface.
  • Entity Framework 6 support. There are defaults implementations of the IUser and IUserStore interfaces in Entity Framework 6. For the IUser interface there is a class called ApplicationUser and another one called UserStore for the IUserStore interface. This makes it very straightforward for developers to know which data is stored and how it is stored. Finally there is an ApplicationDbContext class for the developers to setup a connection string to indicate the database to be used.
  • Asynchronous support and many virtual methods. A good amount of methods have asynchronous support which many of the applications can benefit from. Here you can see more documentation about it. Also, most of the APIs are virtual; if the developer needs to customize any of the built-in behavior then he would simply override the appropriate method.

In this post we will build an MVC application using ASP.NET Identity provider with an integer primary key, which will require some changes to the default template. The provider is by default using the UUID type so with MySQL we will do the necessary changes to use an integer type instead as the primary key for the users table.

Requirements:

– Visual Studio 2013 update 4
– A running server with MySQL 5.6 (can be downloaded here).
– Connector/Net 6.9.6 (download it here)

Create the MVC Application

Open Visual Studio 2013 and click on File Menu and select New Project. Make sure you are using the .Net 4.5 Framework version.

New Project - Microsoft Visual Studio

Select the Web Category and then select the ASP.NET Web Application to start with the template that has the ASP.NET Identity provider set up already. Notice that the type of Authentication used is by default Individual User Accounts, which is the one using ASP.NET Identity provider.

Select a template - ASPIdentityWebApplication

Customizing the application 

Once the application is created there are two files related to the Identity provider back end: IdentityModel and IdentityConfig. Here’s an image that highlights these two files.

SolutionExplorer - App parts

Step One: Customization of the ApplicationUser class

We have mentioned that the ApplicationUser class is the one that implements the IUser interface, hence we would have to use the implementation with the generic type for the primary key in order to customize it. Documentation of the API in this class can be checked here

Open the IdentityModels.cs file, and change the definition of the ApplicationUser class to be like the following:

 

The signature of this class has the following type parameters:

int: The type of the key, for this case int.
UserLoginIntIntPk: The type of the login.
UserRoleIntPk: The type of the role.
UserClaimIntPk:n The type of the claim.

Due the usage of this constructor it is necessary to add the following new classes:

 

After adding these classes, comes the personalization of the IUserStore interface.

Add the following code to the IdentityModels file:

 

Lastly the IdentityDbContext class customization:

 

Notice the integer type used on each of the classes definition.

Step two: Customize the IdentityConfig.cs file

Change the following “old code” to the “new code”:

Old Code:

 

New Code:

 

Old Code:

 

New Code:

 

Old Code:

 

New Code:

 

Old Code:

 

New Code:

 

Third Step: Open the Startup.Auth.cs from App_Start folder and change “old code” to the “new code”:

Old Code:

 

New Code:

 

Fourth Step: Changes in the AccountController file

Old Code:

 

New Code:

 

In the internal class ChallengeResult change the UserId type to the integer type:

 

New Code:

 

Fifth Step: Web.config file changes.

The connection string should look like this in the web configuration file:

 

Change the value to the credentials you will be using and make sure you also include the port in the connection string, if the port is not 3306, which is the default value.

The EntityFramework section also has to include the MySQL provider:

 

Running the Application

Once all the changes are done, we can run the application and create a user.

RegisterUser

Login page:

LoginUser

The structure of the database created by the provider is shown in the image:

ShowTables;

The data of the user in the user’s table:

SelectUsers

That’s all

Conclusion:

The ASP.NET Identity provider is a very good option to manage authentication data with a good level of customization. In this example we changed the default values used to the ones that let us define a different data type for the primary key.

Quick links

Hope you find this information useful.

MySQL community recognition

On behalf of myself and the MySQL Engineering team, I’d like to thank everyone for naming Oracle the Corporate Contributor of the year at the MySQL Community awards ceremony at Percona Live 2014.

I’d also like to thank everyone who have come up to me and my fellow colleagues in person to thank us for the great work they have seen in MySQL 5.6 as well as 5.7. I only wish that more people in the MySQL Engineering team would be able to share that experience.

Therefore I cannot stress enough how important it is for my team to hear such positive feedback through talks, blogs, and tweets. Thank you for doing so, and please continue sharing your positive experience with MySQL openly. Why not read about the latest mysql engineering work and leave a comment on mysqlserverteam.com, it is a huge motivator.

Tomas

Announcing new Yum repositories for MySQL

The MySQL Engineering Team at Oracle is excited to announce availability of Yum repositories for MySQL, making new releases of MySQL Database and related products easily accessible using Yum.  This initial release is focused on EL6-based distros as well as Fedora 18 and 19, and provides easy access to the most recent GA releases of our most popular products:

  • MySQL Database 5.6
  • MySQL Workbench 6.0
  • MySQL Connector/ODBC 5.2

We expect to expand this in the future to offer additional MySQL products and versions using these repositories, as well as repositories for additional Linux distributions.

This effort benefits both end users and Linux distributions.  Users will have additional choice in deploying specific versions of MySQL products using their favored package manager, while Oracle helps reduce overhead in packaging MySQL for specific distributions.  For users, the benefits are:

  • Ability to get MySQL components not yet packaged by their Linux distro.
  • Access to the latest and greatest versions of MySQL, even if they have not yet been adopted by their Linux distro.
  • Packages of MySQL products supported by Oracle.
  • Easy early access to pre-GA product releases, such as MySQL 5.7 Development Milestone Releases.

Equally important in driving this effort is our continued and expanding commitment to Linux distributions.  For this audience, the key benefits are:

  • Increased attention to packaging needs and concerns at Oracle means fewer opportunities for changes to be introduced which cause downstream packaging problems without awareness first at Oracle.
  • Maintainers have access to our packages as a template for solutions to packaging issues.
  • Oracle will have increased, distribution-specific experience and knowledge to draw upon in support of maintainer requests.
  • Packaging work will start before product GA at Oracle, allowing packaging to mature concurrently with the product it supports.

We’re excited to get MySQL 5.6 – the best release of MySQL Database ever – into the hands of more users, and to invest more in supporting maintainers in their efforts to package MySQL products for use within their Linux distributions.  These packages have been extensively tested internally, fully supported, and install fully tested and supported MySQL products.  Listed below are several resources you may find useful in deploying MySQL using the Yum repositories:

Please let us know about your experiences with these new repositories, as well as any suggestions you may have to improve the experience.  We welcome feedback – both bug reports and feature requests – via bugs.mysql.com (there is a new “MySQL Repositories” category).

Also have a look at Norvald’s blog post documenting the team’s work producing these packages

Join us at MySQL Connect

I’m excited about this year’s MySQL Connect in San Francisco. It’s bigger than ever, with 3 days of sessions, tutorials, and hands on labs.  We have more MySQL engineers going there than ever before. Looking at the keynote we are preparing, we have a lot of great news, and exciting benchmark numbers to share.

If you have a chance, make sure you join us this year. Learn about the latest MySQL engineering development, and use this opportunity to talk to the MySQL engineers themselves.

Hope to see you there, Tomas

 

MySQL Server 5.6.13 Community Release Notes

MySQL Server 5.6.13 has been released, and is available (as always) in GPL-licensed Community builds as well as commercial-license builds for evaluation and customer use. By my count, the release notes show just over 100 bugs fixed, improving user experiences both for community and customer users of MySQL 5.6 alike. The MySQL community was an integral part of that effort, submitting almost 40 of the bug reports fixed in 5.6.13. I’m taking this opportunity to express my gratitude on behalf of the MySQL Engineering team at Oracle for these efforts.

  • Po-Chun Chang has identified a series of code optimizations, frequently providing patches. In Bug#69377, this comes in the form of an optimization by eliminating needless work in an internal InnoDB function.
  • Multi-threaded slaves could hang on binlog rotation, due the Bug#69369 identified by Santosh Praneeth Banda. We appreciate the patch, even though we ended up fixing it differently.
  • Bug#69341 from Yoshinori Matsunobu exposed a bottleneck with semi-sync replication with many clients, and while there technically wasn’t a patch submitted, Yoshinori’s deep code analysis pointed the way forward.
  • Yoshinori was similarly responsible for Bug#69316, which reduces DROP/ALTER TABLE time for InnoDB tables.
  • Davi Arnaut found an optimization opportunity in InnoDB’s handling of concurrency tickets during row reads in Bug#68869.
  • InnoDB’s new FULLTEXT now mirrors that of MyISAM with respect to leading wildcards in search terms, as a result of Zoltan Fedor’s report in Bug#68949.
  • Davi contributed again with his report of Bug#68501, which allowed InnoDB to keep under-filled index pages incorrectly.
  • InnoDB tables could be left in an inconsistent state during ALTER TABLE commands when foreign key checks are disabled, as reported by Ernie Souhrada in Bug#65701.
  • Lawrence Holtsclaw reported in Bug#61656 that CREATE TABLE statements with comments containing escaped apostrophes could trigger silently omit the foreign key definitions.
  • Thanks to Kolbe Kegel’s two related bug reports – Bug#68602 and Bug#68599 – warnings issued related to the storage of replication credentials are clarified.
  • Bug#68460 fixed a hang where FLUSH TABLES WITH READ LOCK was followed by replication updates and a subsequent SHOW SLAVE STATUS.
  • Calvin Sun identified a regression in Bug#69127 related to how InnoDB would trigger server-level handling of deadlock conditions in subqueries in an UPDATE statement.
  • Bug#59905 addresses plugin compatibility on certain platforms, such as PPC and ARM.
  • Alexey Kopytov found unoptimized macros being used on certain platforms in Bug#61179.
  • mysqldump will no longer fail when dumping from older MySQL Server instances which don’t have the mysql.general_log and mysql.slow_log tables, thanks to Bug#65670 reported by Van Stokes.
  • Chito Angeles found a problem with InnoDB’s handling of apostrophes in BOOLEAN FULLTEXT searches in Bug#69216.
  • Jan Rusch also contributed an InnoDB FULLTEXT search bug report in Bug#68720, which prevented modifiers from being used in conjunction with quoted literal phrases.
  • MySQL will now recognize those storage engines which declare that they use extended secondary keys for certain optimizations that were previously hard-coded for InnoDB, thanks to Bug#68469 reported by Artem Livshits.
  • Dan Kloke found in Bug#52582 that certain multi-table COUNT(DISTINCT) queries when big_tables were enabled returned wrong results.
  • Per Bug#68438, mysql_install_db would fail against MySQL instances built without InnoDB. Thanks to Rene Berber for the bug report!
  • CREATE TABLE IF NOT EXISTS no longer requires exclusive metadata locks as a result of Michael Skulsky’s Bug#63144.
  • Colin Charles and Hye Chung each identified potential RPM build problems from source due to a missing pb2user in Bug#63144 and Bug#69339, respectively.
  • Due to a typo in CMake scripts identified by Takashi Ichii in Bug#60743, DTrace wasn’t properly enabled.
  • Takashi Ichii also identified a performance issue with PERFORMANCE_SCHEMA in Bug#69382.
  • In Bug#68897, Helmut Lange found a defect which could return wrong results for certain LEFT JOIN queries with GROUP BY clauses.
  • Yoshinori identified a misleading error message related to global transaction IDs in Bug#69096.
  • Bug#62769 identified another portability problem and was solved.

Thanks to all of the above community contributors who invested time in reporting bugs, and especially to those who dug into code to provide analysis or patches.

Tomas

The MySQL Man Pages ARE Available under the GPL

Due to a bug in our release packaging scripts, the wrong version of the man pages, with the wrong license text, were copied into the MySQL Server GPL packages. The MySQL Man Pages continue to be available under GPL. The MySQL Server GPL packages will be corrected ASAP. You can read and follow the public bug here.

We apologize for the confusion this has caused. As always, please feel free to contact us, to ask about changes that you are wondering about.  Reporting a bug is always a good way to communicate with us.

Have a Happy GPL Midsummer, Tomas

MySQL Workbench 6.0 – A Sneak Preview

The MySQL Developer Tools team is known for their steady release cycle, putting out a new MySQL Workbench release every 4-5 weeks. Now that it has been a bit quiet for a while you may wonder what is going on. Let me share some inside knowledge of what’s happening behind the scenes.

MySQL Workbench is a key component of our MySQL stack and extremely popular as shown by download numbers and interest in our white papers. It is the face of MySQL on the desktop, and we aim to make it even more popular for developers & DBAs than it is today. We have been looking for strong C++ and Python developers to grow the team further, and I’m happy to welcome Marcin Szalowicz from Poland and Miguel Tadeu from Portugal who started this Monday. They are going to work on both, the C++ backend and the native UI frontend of the product.

WB6.0SplashSmallFor some time the focus for the team has been on the next major release of MySQL Workbench which will be called 6.0. If you are familiar with the current version (5.2) you are going to see that we have been listening carefully to the feedback we’ve got. Here are the main areas that have been improved.

Simplified Workflow

The current WB 5.2 UI was designed for three specific workflows, SQL Development, EER Modelling and Administration. This is represented by the 3 main areas of the WB 5.2 Home screen and makes good sense if you have a very specific role in your company and use WB for that specific purpose, e.g. Administration of MySQL servers. What we learned is that e.g. many developers working in the SQL Editor also want to perform administrative tasks on their development machines and therefore also open an Administrator session. The same is true for DBAs using the SQL Editor to run scripts and queries.

For that reason we have unified SQL Development & Administration and made both available in a single session when you connect to your MySQL Server. The connections now take the main area of the new, redesigned WB 6.0 Home screen. We have also adopt a modern looking UI.WB6.0HomeScreenExSmall

Enterprise Feature Support

MySQL Enterprise Backup and the new Audit Log functionality found in MySQL 5.6 Enterprise are very compelling features for our customers. We got many requests to deliver a streamlined GUI for these features that will now be released as part of WB 6.0. MySQL Workbench will perform all tasks that are needed to configure your MySQL installation for the use of the backup feature and setting up an incremental backup is now as easy as clicking a button.

Wb6.0EnterpriseBackupSmall

Improved Code Quality

Another area of focus was to improve the quality of the product. WB 6.0 will contain over 100 bug fixes and will be tested by a dedicated QA team. We are soon going to launch the public Beta test phase and with the help of the MySQL community the WB 6.0 will be the best MySQL Workbench release to date.

More Than 50 Improvements

Apart from working on the major UI changes a lot of work has been invested in improving and extending existing features like Server Status overview, Visual Explain, Editors, Schema Inspector, Table Data Search, and much more.

I hope you got interested in the upcoming MySQL Workbench 6.0 release and you will join the Beta test when it is first announced.

 

April MySQL Engineering News

On a regular basis I plan to summarize the latest news from MySQL Engineering. I hope you find it useful.

April highlights were the DMR’s coming out for both MySQL Cluster 7.3.2 and MySQL Server 5.7.1. For those that have been missing the launchpad versions of those, I apologize for the delay, but they should be there now if you want to dig into the changeset details. And to repeat what I’ve said in the past, there should not be a delay between releases on launchpad and src tar balls, so please keep bugging me when you see glitches there. Personally I also very much enjoyed the April Percona conference where I met a lot of old good friends and gave a keynote. You can see it here or just read the presentation. Here follows a summary of the engineering blogs from last month.

MySQL Support
The MySQL support team has some excellent blogs well worth reading.  The latest month includes for example “Migrating to InnoDB Full text search…”, “MySQL Utilities…”, and plenty of recent 5.6 info.

MySQL Performance Schema (PS)
This is a tremendously powerful tool, but it can be overwhelming to familiarize yourself with. Learn more about configuring performance schema from the author Marc Alff. Feel free to give him feedback directly on his blog, the good as well as constructive feedback. I’d also like to draw your attention to an older blog by Mark Leith, ps_helper. We are currently considering how we could include something like that in the product to make is easier to use PS. Ideas and input are greatfully received.

MySQL InnoDB
InnoDB continues to be the storage engine we focus on together with NDB for MySQL Cluster. You can learn more about the Data Organization in InnoDB, and the new 5.6 feature InnoDB transportable tablespaces and how to use them. Also have a look at Sunny’s presentation about 5.6 InnoDB features and scalability at Percona Live in April

MySQL Cluster and NoSQL
I mentioned the new DMR 7.3.1 for MySQL Cluster. Our efforts to improve ease of use of Cluster continues, please learn more about, and try out, the autoinstaller. MySQL Cluster was there as a “NoSQL” database long before the term was coined, and was just awarded the “storage engine of the year” the other week. This DMR also contains support for Foreign Keys which I know some of you have been waiting for. I’ll encourage the cluster engineers to write an in depth blog about the complexities in supporting foreign keys in a distributed databases. Meanwhile please get an overview here.

MySQL Performance
Dimitri is continuing his great work on benchmarking MySQL 5.6, comparing it with different 5.5 versions, including MariaDB and Percona servers. His blogs are excellent reads for anyone interested in MySQL performance.

MySQL Testing
In my keynote at Percona Live I talked about the big investment we have made in QA for MySQL. Please take a moment to learn about MySQL Server QA.

MySQL Replication and Big Data
MySQL 5.6 contains many new replication features, learn about the lesser known but equally important new replication features. Luis gave an excellent presentation at Percona Live on MySQL Replication, where you can learn more about performance enhancing features like multi-threaded slave and binary log group commit, as well as global transaction identifiers that can help you to do failover much better.

In my keynote at Percona Live I talked about how MySQL plays in important part in the Big Data lifecycle, and the new Hadoop applier for MySQL. Here is some more reading from Shubhangi, Hadoop applier part 1 and part 2.

MySQL Optimizer
MySQL 5.6 contained a lot of Optimizer enhancements. Here is a blog on subqueries from Øystein, a senior member of the Optimizer team, also aggregated to the MySQL Optimizer blog if you are interested in older posts.

MySQL on Windows
Our focused effort to on MySQL on Windows continues. New this month is the beta of the Connector/Net 6.7.2 which includes support for connecting to the MySQL memcached interface as well as load balancing. If you have not yet tried out MySQL for Excel I encourage you to try the newest version. You can follow the development of MySQL on Windows blog if you are interested.

MySQL General
Please have a look at Mikael’s insights about MySQL Engineering. And read about the fixing of a long standing trigger bug which is also aggregated on the MySQL Runtime blog.

MySQL Cluster gets a Community Award

It was with pride I entered the stage at the Percona MySQL Conference yesterday to receive the “Storage Engine of the Year 2013 award” for ndb (the MySQL Cluster storage engine).  Thank you very much, on behalf of myself and the MySQL Cluster engineering team. The team has done a great work over the past 10 years to harden the product, and add new features. MySQL Cluster milestone 7.3.2 was just released. It will be my pleasure to present the “trophy” some members of the team when I get back to Stockholm. Please see a previous post for how the MySQL Cluster journey began for myself and the ndb team 10 years ago.