I am trying to run a JSP file deployed to Amazon's Beanstalk, which uses DataNucleus to connect to RDS, and am getting the following error:
javax.jdo.JDOFatalDataStoreException: No suitable driver found for jdbc:mysql://mydbblahblah.rds.amazonaws.com:3306/mydb?autoReconnect=true
root cause
java.sql.SQLException: No suitable driver found for jdbc:mysql://bmydbblahblah.rds.amazonaws.com:3306/mydb?autoReconnect=true
java.sql.DriverManager.getConnection(DriverManager.java:640)
java.sql.DriverManager.getConnection(DriverManager.java:200)
Now I have the MySQL connector files in the classpath (it is at WebContent/WEB-INF/lib/mysql-connector-java-5.1.15-bin.jar, so this should work.
I have also confirmed that if I remove the library from there, I get the "com.mysql.jdbc.Driver not found on CLASSPATH" error.
Here is what my datanucleus.properties file looks like this:
javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.api.jdo.JDOPersistenceManagerFactory
javax.jdo.option.ConnectionDriverName=com.mysql.jdbc.Driver
javax.jdo.option.ConnectionURL=jdbc:mysql://bmydbblahblah.rds.amazonaws.com:3306/mydb
#javax.jdo.option.ConnectionURL=jdbc:mysql://localhost:3306/mydb?autoReconnect=true
javax.jdo.option.ConnectionUserName=user
javax.jdo.option.ConnectionPassword=pwnothere
All of this works on my local Tomcat connecting to RDS. It only fails when running on Beanstalk.
Any ideas what might be causing this issue?
Thanks
I [almost] resolved this issue using the following procedure:
http://www.cubehouse.org/blog/2011/03/04/using-rds-aws-mysql-on-an-elastic-beanstalk-java-tomcat-server-with-ec2-security-permissions/
With the addition that your EC2 Security Group needs a rule set for port 3306.
Sadly, this code can read but not write.
So we downgraded to DataNucleus 2.0 without any other changes, and the issue disappeared. Sad, but it worked. I cannot recommend newer versions of DataNucleus with MySQL.
Related
I have a mysql 8.0.3 database over top of that maxscale server is running when i tried to connect with that mysql jdbc driver this error is coming unknown system variable 'query_cache_size'. But when i tried to connect directly to database is working for me. query_cache_size parameters removed from mysql 8.
The query cache has been deprecated. BTW 8.0.3 is a very old version (4 years) and was pre-general availability (a release candidate) so please do not use it for production.
Edit: With MXS-2890 fixed, you should now be able to configure version_string=8.0.16-mysql in MaxScale to solve this problem
This is most likely caused by the following bug: https://jira.mariadb.org/browse/MXS-2890
The MariaDB JDBC connector should not suffer from this problem which means installing it instead of the MySQL JDBC connector can be used as a workaround.
In your /etc/maxscale.cnf you can add version_string=5.6
[Read-Write-Service]
type=service
router=readwritesplit
servers=master
version_string=5.6
user=user
password=********```
after that i am able to access mysql8 on top of maxscale server.
I ve just recently discovered OctoberCMS. Everything works perfectly on my localhost server. Once i deploy to production server i get the following error:
"Database missing
A database is required to access the back-end. Check the database is configured and migrated before trying again."
I have tried installing from cPanel and have also tried ftp and making sure the .env reflects my production database details, but still getting same error.
Can anyone here plz help? Thanks a lot in advance.
You should check all database accesses in config/database.php file. If the access is correct, try reading the configuration cache with php artisan config:clear.
If this does not help, and the error does not change, it is worth checking the availability of the library responsible for connecting to the base in your php.ini file. In my case, the problem was exactly there (the library was closed)
I had that error after fresh install...After restarting the php server, the error was gone
I'm building a NiFi dadaflow, and I need to get the data changes from a MySql database, so I want to use the CaptureChangeMySQL processor to do that.
I get the following error when I run the CaptureChangeMySQL processor and I don't see what's causing this :
Failed to process session due to Could not connect binlog client to any of the specified hosts due to: BinaryLogClient was unable to connect in 10000ms: org.apache.nifi.processor.exception.ProcessException: Could not connect binlog client to any of the specified hosts due to: BinaryLogClient was unable to connect in 10000ms
I have the following controller services enabled :
DistributedMapCacheClientService
DistributedMapCacheServer
But I'm not sure if they are properly configured :
DistributedMapCacheServer properties
DistributedMapCacheClientService properties
In MySql, I have enabled the log_bin variable, by default it wasn't. I checked and I have indeed some binlog files created when data change.
So I think the issue is with the controller services and how they connect, it's not clear to me.
I searched for tutorials about how to use this NiFi processor but I couldt not find how to fix this error. I looked mainly at this one : https://community.hortonworks.com/articles/113941/change-data-capture-cdc-with-apache-nifi-version-1-1.html but it did not helped me.
Does anyone have already use this processor to do CDC?
Thank you in advance.
I found what was wrong : I was trying to connect to the wrong port for the MySQL Host of the CaptureChangeMySQL processor :x
For others who are still facing similar issues, check if the firewall of the server is stopping the connection. Allow mysql 3306 in your firewall rules.
Last night AWS RDS had an "Internet Connectivity Issue" that was resolved a short time later. However, my app (which runs in .NET Core and connects to an RDS MySQL instance via Pomelo.EntityFrameworkCore.MySql) could never re-establish a connection to the database even though the MySQL server was back online. I tested connecting from my own local machine and it worked just fine. I then re-deployed the .NET Core app it everything started working again.
Is there something that I need to re-create (the db context perhaps), or is there something that is being cached that I need to flush to try to connect again? I connect via hostname, and my connection string looks something like this:
server=something.somewhere.us-east-2.rds.amazonaws.com;userid=XXXX;password=YYYYY;database=ZZZZ
Here is the Exception being thrown:
MySqlException: Unable to connect to any of the specified MySQL hosts.
at MySqlConnector.Core.ServerSession+<ConnectAsync>d__56.MoveNext (C:\projects\mysqlconnector\src\MySqlConnector\Core\ServerSession.cs:239)
and here is how I create my db context in Startup.cs:
services.AddDbContext<BlayFapContext>(opt => opt.UseMySql(Settings.Instance.SQLConnectionString));
Any help would be greatly appreciated.
Giawa
Okay, we worked out what happened. Pomelo's MySQL wrapper had an issue as outlined in their git repo here: https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/434
Basically, if a MySQL database is not available when the connection string is first used then it will be cached as invalid and will never work again. You can easily confirm this by launching a service with no MySQL connectivity, verify it doesn't work, then launch MySQL and confirm that the service still doesn't work. It can never establish a MySQL connection after the first connection string is found to be invalid.
They patched it shortly after the 2.0.1 release, but they haven't updated Nuget with a new version since then, despite the issue being found 6 months ago. So, the fix is to checkout their repository source code, and patch it ourselves. We found the fix here works just fine: https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/pull/456
So, why was the connection string retried? We already had a successful connection! It turns out that the internet connectivity issue with the Ohio data center was not limited to RDS, but also affected EC2. Our EC2 instance was rebooted as part of the fix, and the MySQL connection wasn't valid when it reboot due to the continued connectivity issues. The state of that connection was cached, and even though the MySQL server came back online our service was toast.
Giawa
The yii requirements page says PDO extension + the mysql driver works, phpinfo() says that PDO and the MySQL driver is installed, I have configured the 'db' component in the main config file for my project generated with yiic webapp, checked and double checked that the settings are correct (and yes, I am using mysql).
I have made a new migration script in /[mywebapp]/protected/migrations and now I'm trying to run the ./protected/yiic migrate command, but i just get an exception:
exception 'CDbException' with message 'CDbConnection failed to open the DB connection: could not find driver'
I have no idea what is wrong. I have been googling for 2 hours now and i find a lot of other users experiencing the same problems, but usually they are missing the drivers or something obvious. Is there anything i'm completely overlooking?
Despite the real answer being in the comments for this question, I am answering it here so that it appears as an answer. Yiic.php migrate uses the configuration stored in console.php. You need to set your database connection in there to use yiic.