setFetchSize() on mysql above 5.0.3? - mysql

Mysql documentation says
When using versions of the JDBC driver earlier than 3.2.1, and connected to server versions earlier than 5.0.3, the setFetchSize() method has no effect, other than to toggle result set streaming
What about after 5.0.3? Can I use setFetchSize(100) now? Will it work?

It will indeed work if you also set the JDBC option useCursorFetch for the connection.
However, due to the way MySQL implements server-side cursors, you will have to wait for the query to complete on the server before results arrive, and you will consume additional memory server-side.

Related

Maria DB AES_DECRYPT() with CBC encryption mode

mysql shows error : Error in query (1582): Incorrect parameter count in the call to native function 'AES_DECRYPT'
I'm using mariaDB
I have tried differnet options but all ends up at same place
SET #key_str = '3C5QYgFQr9AARjMyLNNQ3fL8QauXLTz0';
SET #iv = 'kaNUE3JAIVB9Em9v';
SET #ciphertext = AES_ENCRYPT('Hello', #key_str, #iv);
SELECT AES_DECRYPT(#ciphertext, #key_str, #iv);```
My requirement is to use aes-256-cbc encryption using MariaDB
If you are using MariaDB, you should read the MariaDB documentation, not the MySQL documentation.
https://mariadb.com/kb/en/aes_encrypt/ shows AES_ENCRYPT() only has two arguments. This matches the implementation of that function as of MySQL 5.5, when MariaDB forked from MySQL in 2010. Since then, MySQL 5.7 and later changed the function to accept more arguments.
In general, you shouldn't think of MariaDB and MySQL as variants of the same product anymore. They have both changed significantly since they forked, and there are many cases where they are no longer compatible.
Here's a feature request for MariaDB to support the IV and block encryption mode: https://jira.mariadb.org/browse/MDEV-9069
As of 2022-12-12 (version 10.10 is current as I write this), the feature is not yet implemented. So there is no support currently in MariaDB for CBC or other encryption modes. It still functions as it did in MySQL 5.5.

Error with the version of the database in liferay 7

I work with Eclipse and I want to use the version 7 of Liferay but when I run my Tomcat server I have an error with MySQL.
Please upgrade to at least MySQL 5.6.4. The portal no longer supports older versions of MySQL
Like this the problem is pretty obvious but my SQL version is already 5.7.19
I have check my driver of MySQL in preference->data management->connectivity->driver definition and my MySQL JDBC Driver is 5.1
I want to know if someone already had this issue and know how to fix it
This is how the version gets validated, and this is how the version string gets constructed. I'd say: Please make extra extra extra sure that you are addressing the mysql server that you intend to address:
You can check your mysql version from the mysql command line client by executing select version();. Get your credentials and database URL from Liferay's portal-ext.properties or your appserver's connection pool configuration, depending on where you configured it.

Sequelize.js: how to handle reconnection with MySQL

I've always used Mongo with Node, but now due to an existing datasource I need to connect a node app with Mysql.
Sequelize seems a good solution, but I don't get how to handle connection error, reconnection and re-tries.
To check for connection error on first run .authenticate().then().catch(function(error){...});
But what if I loose connection and want to reconnect?
There is an open issue for this in Sequelize:
https://github.com/sequelize/sequelize/issues/2113
Based on that, this error is handled in sequelize.
I verified the version 4.11.1 of sequelize has this issue fixed.
The queries will fail when the database server is down, but will recover to reconnect and succeed when the database server is up.
(You don't need to restart the application as faced with previous versions.)

Mysql Entityframework throws exception "Facet 'Precision' must not be specified for type 'datetime'"

I am using MYSQL and EF5(DB first) with connector/net 6.8.3.0. Everything works fine on my local machine but when I upload it to server it throws exception "Facet 'Precision' must not be specified for type 'datetime'".
Please let me know what is the reason.
Precision for datetime is added with MYSQL version 5.6 and I have generated the entities with latest MYSQL, so by default precision is added to the ssdl.
But on my server older version of MYSQL server was installed. This is the reason why it was throwing the exception.
Now with MYSQL server 5.6 we can have datetime(5) where 5 is the precision.
So we can have microsecond for datetime in MYSQL.
I too have been getting the "Facet 'Precision' must not be specified for type 'datetime'" error after publishing, but the cause of my problem differs from the OP's.
My Personal Solution
I have two independent servers: 'server1' with the EF5 web app, 'server2' with the database server1 references. Debugging the app on my local machine was no problem; but after I published to server1 the app kept crashing while trying to load. After much searching and testing I narrowed it down to either a configuration issue either with my application or MySQL. Finding this post (thank you kindly, user3275493, for answering your own question), I checked server2's MySQL config but alas it was already running MySQL Server 5.6. Just to be thorough (in reality this took me several days to realize), I decided to check MySQL Connecter and discovered that my local machine's was version 6.8.3 while server1's was version 5.6. After I updated Connector, I published my web app and it ran without flaw!
Simple Explanation
Not only will this error be caused by a MySQL version disagreement between Entity Framework and MySQL Server, but also between Entity Framework and MySQL Connector!

mysql persistent connection

How to close a mysql persistent connection?
What language are you using? Php? Persistent connects will timeout if on an non-interactive session based on the wait_timeout variable in my.cnf. See http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_wait_timeout
If you are using PHP (just guessing here) take a look at http://php.net/manual/en/function.mysql-pconnect.php and http://www.php.net/manual/en/features.persistent-connections.php
There are some interesting discussions on the use of persistent connections - http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/
You can't, simply wait for database server restart to reset all connection or maximum allow connection exceeded
There is no reason to issue persistent connection as it just hold the connection resource without release, another word, if your site having lots of traffic, soon you will get a connection error message.
And there is no reason to use mysql related function, switch to mysqli or pdo.