com.mysql.jdbc.exceptions .jdbc4.CommunicationsException: Communications link failure - java

I have a java plugin to an application that I'm using (I didn't write it and don't have the source) that connects to my MySQL database...the only problem is that anytime I try to load the application I get a communication link failure
17:51:57 [INFO] Could not create connection: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
17:51:57 [INFO] Database initialization failed: java.lang.NullPointerException
I have verified that all of my mysql settings are pointing to the correct port that I'm giving this plugin and I've also checked to make sure the user I created for this has privileges over the database it's going to be modifying. I'm out of ideas and it never times out, I would think it was the plugin but the plugin has many users and they use the plugin with MySQL just fine and I continue to have the problem after reinstalling the plugin.
I'm sure it's an issue with MySQL but as far as I can tell...everything is fine, so any clues about what would cause this would be great. I've been reading around and the stuff I've seen didn't help the issue.
SOLUTION
for UBUNTU and MySQL 5.1: Added mysqld : ALL to /etc/hosts.allow

for UBUNTU and MySQL 5.1: Added mysqld : ALL to /etc/hosts.allow

Related

JPA tools will not connect to SQL Server

I am trying to connect to a database on my localhost machine from Eclipse using the JPA tools. I have been unable to achieve this so far. I want to create a JPA project and create the model from the tables that I have already created on the database. I do not seem to be able to get the connection string correct.
firstly I seem completely unable to create a SQL Server connection profile. Once I get to the second screen no options available that allow me to progress past it to completion. Found a thread on here that claimed this is a bug and I should use the generic driver instead. So this is what I tried.
I thought that the port number was 1433 and I have tried that but no change. I have also taken off the (localdb) part as the error message referenced it. Message remains the same.
Error Message
com.microsoft.sqlserver.jdbc.SQLServerException: The connection to the host (localdb), named instance mssqllocaldb failed. Error: "java.net.UnknownHostException: (localdb)". Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later, verify that the SQL Server Browser Service is running on the host.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:191)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.getInstancePort(SQLServerConnection.java:5247)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.primaryPermissionCheck(SQLServerConnection.java:1871)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1608)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1459)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:773)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1168)
at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.createConnection(JDBCConnection.java:328)
at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:105)
at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:54)
at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.open(JDBCConnection.java:96)
at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnectionFactory.createConnection(JDBCConnectionFactory.java:53)
at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83)
at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:359)
at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76)
at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
I got the connection string from Visual studio as that is how I created the tables.
Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=IdpValidate;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False
I have checked the firewall on my machine but Eclipse is in there and I can connect no problems from Visual Studio so it can't be that (can it).
SQL Server Agent and SQL Server Browser are both on (again I can connect from elsewhere; mssms, vs, linqpad etc) Please help this is driving me mad!
I have also created a login and user (LetMeIn) but at the moment this is not making a diffrence as using my computer account can't connect through Eclsipe either.
It turns out I have two sql servers installed on my machine and I was trying to connect to the wrong one. :(

Netbeans persistence.xml - definition of path for persistence unit

I have an application that connects to a Derby database using the Derby Network Server that has been started as a standalone process outside of the Netbeans IDE.
When I run my application within the IDE (I don't start the Network Server from the Services tab as it is already running) the following is observed:-
The application connects successfully to the server.
Subsequent database accesses fail with error Internal Exception: java.sql.SQLNonTransientConnectionException: The connection was refused because the database MyAppDB was not found.
Error Code: 40000
The persistence.xml in Netbeans shows the following for the JDBC connection:-
jdbc:derby://localhost:1527//Users/David/Desktop/DerbyDatabases/MyAppDB
[david on TEST]
However the xml source in Netbeans shows the following:-
jdbc:derby://localhost:1527/MyAppDB
I can fix this problem by changing the persistence.xml source (in Netbeans) to show the following for JDBC connection:-
jdbc:derby://localhost:1527//Users/David/Desktop/DerbyDatabases/MyAppDB
Everything now works and the application runs fine :-)
HOWEVER!!!
As soon as I tell Netbeans to do a Clean and Build Project, it reverts the JDBC connection back to:-
jdbc:derby://localhost:1527/MyAppDB
On running the Application it can no longer access the Db with the same error as above.
Note that none of these problems occur if I run the Network Server from with Netbeans by opening the connection via the Services tab. This is no good for me as I want to deploy the application.
Do any of you guys know what is going on here? - I'm sure it's a simple mistake on my part.
Thank you.
This problem was eventually solved by deleting the persistence unit (using NetBeans) and re-creating it with the same name but with the JDBC connection containing the correct path. Is this a NetBeans problem?

Hadoop cluster java.net ConnectionException: Connection refused error

I used to have a hadoop cluster running with centos 6.5 that was built using a gui. It made everything work perfectly. For a bunch of reasons that are not relevant i needed to upgrade to centos 7. The gui i used to install it on 6.5 just doesnt have centos 7 as an option. As a result I have to manually install it on a new centos 7 cluster. I keep running into this error.
Call From Cluster-Client-1/ip.add.ress to Cluster-Client-1:8020 failed on
connection exception: java.net.ConnectException:
Connection refused; for more details see the website
The relevant port on my cluster is 50010 so i think where it says "cluster-client-1:8020 that it should say 50010 but i dont know where that appropriate file is or how to change it. The ip-address is correct. You probably need more information to answer my question. but I don't know what you need so please ask away. There are currently no slave nodes in the cluster I'm in the process of adding more but i need to solve this error before i can move on.
Please help

sqljdbc4 2 on Glassfish server4 1

I am running my java web application on glassfish server v4.1 in netbeans v8.0.2, using sqljdbc42 and this connection code-
Connection connection;
String url = "jdbc:sqlserver://localhost:1433;databaseName=Lista;integratedSecurity=true";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
connection = DriverManager.getConnection(url);
When i open my ide and run my project for the first time the glassfish server starts automatically since my project's server is glassfish, and i can perform any crud operation with my Ms-Sql server2012.
But the problem starts when i make changes in any file keeping the server on and run the project again and try to perform any crud operation i get this following error-
com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not
configured for integrated authentication
But if i stop the server before changing any file and start after changing and run the project then it works without any error.
Stopping and re-starting the server again and again taking so many times from my total project time! Any help or suggestion will be appreciated.
Thank You.
I solved my problem!
The error (described in my question above) i was getting because the glassfish server had not any access on sqljdbc42.jar file. so i have placed the sqljdbc42.jar file into my glassfish server in this location-
glassfish-4.1\glassfish\domains\domain1\lib.
And it's now working perfectly.
Thank you everyone!

I need some help with Sakai 2.7.1 and Tomcat 5.5.33, in regards to SQL issues

Today I managed to recreate the farms with Scalr.net and apparently after a few times restarting tomcat and fixing issues, I get this error once again. The thing is I was using MySQL with a clean install on the entire server, that includes Java 6.1_24, Tomcat 5.5.33, Sakai 2.7.1. The issue I keep running into is user denied when the fact that I have this user in the MySQL Instance, as well giving it complete remote access with sakai#% and even this is not working when it was working about an hour ago since this post was made.
... Continued from above log, everything before logs just fine
2011-03-31 18:31:14,120 WARN main org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy - Could not retrieve default auto-commit and transaction isolation settings
org.apache.commons.dbcp.SQLNestedException: Error preloading the connection pool
... continued over 400+ lines...
Here is another error in regards to the access denied error...
2011-03-31 18:31:16,854 WARN main org.hibernate.cfg.SettingsFactory - Could not obtain connection metadata
java.sql.SQLException: Access denied for user 'sakai'#'ec2-50-17-184-70.compute-1.amazonaws.com' (using password: YES)
.... continued....
I now get this error whenever I startup, this is with a fresh install of tomcat/sakai
SEVERE: Unable to set localhost. This prevents creation of a GUID. Cause was: ec2-72-44-56-167.compute-1.amazonaws.com: ec2-72-44-56-167.compute-1.amazonaws.com
java.net.UnknownHostException: ec2-72-44-56-167.compute-1.amazonaws.com: ec2-72-44-56-167.compute-1.amazonaws.com
(This most recent error (Localhost) was simply fixed by restarting the amazon aws instance. Thankfully) Although I keep getting the same errors even with a fresh install... Almost as if the information is being refreshed from a cache... Or something
As with the last question you posted on this topic, the error message seems very clear: the user 'sakai'#... does not have access to login to the database you have set it up to. I recommend taking a look at the Mysql documentation to understand how to administer the user accounts to find out if you've missed a setting somewhere to allow this account to have access.
I believe I may have figured out how to fix this problem. It has nothing to do with mysql, or the apache server itself. It has to do with the failure of Scalr.net not Initializing the IP or something of that sort. After doing some research I found some issues with the HostInit issues such as....
Cannot deliver message 'HostInit' (message_id: af9dcfdb-a09e-4971-bdb7-7871b3f7e21c) via REST to server '50.17.135.98' (server_id: e49cfec9-5bcb-44d1-bbc5-fde32450fc89). Error: 0 Timeout was reached; connect() timed out! (http://50.17.135.98:8013/control)
Cannot deliver message 'BlockDeviceAttached' (message_id: a153d83f-3d96-4d53-920a-ccb80701675a) via REST to server '50.17.135.98' (server_id: e49cfec9-5bcb-44d1-bbc5-fde32450fc89). Error: 0 Timeout was reached; connect() timed out! (http://50.17.135.98:8013/control)
Cannot deliver message 'HostUp' (message_id: 1adde27c-9982-4551-b266-c3c432d1dd44) via REST to server '50.17.135.98' (server_id: e49cfec9-5bcb-44d1-bbc5-fde32450fc89). Error: 0 Timeout was reached; connect() timed out! (http://50.17.135.98:8013/control)
Cannot deliver message 'HostInit' (message_id: f1aa4b14-ef57-4361-ae56-87702d674b11) via REST to server '50.17.135.98' (server_id: e49cfec9-5bcb-44d1-bbc5-fde32450fc89). Error: 0 Timeout was reached; connect() timed out! (http://50.17.135.98:8013/control)
So what I did was I made a snapshot image of the apache server/mysql etc. and terminated them allowing the recreation of the instance and this managed to solve the problem in one manner.

Categories

Resources