Questions tagged [connection]

Refers to a connection used to transfer data between two endpoints, such as between a client and a web, database, web service or other server.

A connection is a session established between two communications endpoint applications.

10252 questions
82
votes
11 answers

How to check if a socket is connected/disconnected in C#?

How can you check if a network socket (System.Net.Sockets.Socket) is still connected if the other host doesn't send you a packet when it disconnects (e.g. because it disconnected ungracefully)?
lesderid
  • 3,388
  • 8
  • 39
  • 65
78
votes
14 answers

How do I connect to mongodb with node.js (and authenticate)?

How do I connect to mongodb with node.js? I have the node-mongodb-native driver. There's apparently 0 documentation. Is it something like this? var mongo = require('mongodb/lib/mongodb'); var Db= new mongo.Db( dbname, new mongo.Server(…
Mark
  • 32,293
  • 33
  • 107
  • 137
78
votes
11 answers

AWS EC2 Connection closed by when trying ssh into instance

Recently I set up a new EC2 instance. The next day I was not able to connect to my instance via ssh. I could connect and disconnect the day before, I am sure I did nothing. Here is ssh debug info: ssh -i webserver.pem -v…
77
votes
15 answers

mySQL Error 1040: Too Many Connection

How to fix these, "SQL Error 1040: Too Many Connection" even I try to put max_user_connection=500 still "Too many connection"
kelvzy
  • 913
  • 2
  • 12
  • 19
76
votes
41 answers

Failed to connect to mysql at 127.0.0.1:3306 with user root access denied for user 'root'@'localhost'(using password:YES)

I've been trying to create a new database connection on workbench. However, every time I test a connection there is an error message that says Failed to connect to mysql at 127.0.0.1:3306 with user root access denied for user…
cpl
  • 761
  • 1
  • 6
  • 3
74
votes
6 answers

How to kill MySQL connections

I'm building a website with MySQL. I'm using TOAD for MySQL and suddenly I can't connect to the database as I'm getting an error: "Too many connections" Is there any way in Toad for MySQL to view existing connections to be able to kill them or…
leora
  • 188,729
  • 360
  • 878
  • 1,366
74
votes
12 answers

HttpClient 4.0.1 - how to release connection?

I have a loop over a bunch of URLs, for each one I'm doing the following: private String doQuery(String url) { HttpGet httpGet = new HttpGet(url); setDefaultHeaders(httpGet); // static method HttpResponse response =…
Richard H
  • 38,037
  • 37
  • 111
  • 138
72
votes
18 answers

How to check if internet connection is present in Java?

How do you check if you can connect to the internet via java? One way would be: final URL url = new URL("http://www.google.com"); final URLConnection conn = url.openConnection(); ... if we got here, we should have net ... But is there something…
Chris
  • 15,429
  • 19
  • 72
  • 74
72
votes
33 answers

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

The following code: Class.forName("com.mysql.jdbc.Driver"); Connection m_connection = DriverManager.getConnection("jdbc:mysql://localhost","root","root"); Throws this exception on getConnection(): java.sql.SQLException: Access denied for user…
JAN
  • 21,236
  • 66
  • 181
  • 318
69
votes
7 answers

Cannot connect to MySQL 4.1+ using old authentication

I'm trying to connect to a mySQL database at http://bluesql.net, but when I try to connect, it gives this error: Connect Error (2000) mysqlnd cannot connect to MySQL 4.1+ using old authentication I've looked into this, and it has to do with some…
B T
  • 57,525
  • 34
  • 189
  • 207
69
votes
11 answers

How do I shutdown a Node.js http(s) server immediately?

I have a Node.js application that contains an http(s) server. In a specific case, I need to shutdown this server programmatically. What I am currently doing is calling its close() function, but this does not help, as it waits for any kept alive…
Golo Roden
  • 140,679
  • 96
  • 298
  • 425
67
votes
7 answers

Hibernate Slow to Acquire Postgres Connection

I'm having a really difficult time debugging this problem. Whenever I try to establish a connection with postgres, it takes a whole minute. After the connection is established, everything is fine. I've tried disabling all the mappings and not…
Jason Huntley
  • 3,827
  • 2
  • 20
  • 27
64
votes
2 answers

Is it safe to use a static java.sql.Connection instance in a multithreaded system?

I'm running a web application on Tomcat. I have a class that handles all DB queries. This class contains the Connection object and methods that returns query results. This is the connection object: private static Connection conn = null; It has only…
Asher Saban
  • 4,673
  • 13
  • 47
  • 60
64
votes
2 answers

How to increase the timeout for `yarn install`

I'm currently using Yarn on a very unstable internet connection. Sometimes it takes hours until I can finally download all the packages. I noticed Yarn retries the download when there is some kind of the internet connection: [1/4] Resolving…
Fabio K
  • 1,297
  • 4
  • 13
  • 24
62
votes
3 answers

What is the functionality of setSoTimeout and how it works?

I'm trying to learn Socket and I'm confused by following text from Oracle's website: setSoTimeout public void setSoTimeout(int timeout) throws SocketException Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. With this option…
Bernard
  • 4,240
  • 18
  • 55
  • 88