connection

MySQL connection character set problems

佐手、 提交于 2019-12-06 01:27:37
I'm using velosurf with MySQL on a Mac, without any encoding problems, but when I switch to a Linux machine, the values I get from velosurf are not encoded correctly. I found out it might be a problem with the default connection character set. On the Mac I got: mysql> show variables like "collation_%"; +----------------------+-------------------+ | Variable_name | Value | +----------------------+-------------------+ | collation_connection | utf8_general_ci | | collation_database | utf8_general_ci | | collation_server | latin1_swedish_ci | +----------------------+-------------------+ 3 rows in

Maximum number of TCP connections in Python?

戏子无情 提交于 2019-12-06 00:35:15
I am working in Python on localhost. I wrote a raw server just read TCP socket, say in port 50001. Then I tried max client connections: def rawMultiConn(threadnum = 10000): g_event = threading.Event() def threadfn(): sockets = [socket.socket(socket.AF_INET, socket.SOCK_STREAM) for i in range(threadnum)] for s in sockets: s.connect(('localhost', SERVER_PORT)) g_event.wait() for s in sockets: s.close() t = threading.Thread(target = threadfn) t.start() g_event.set() t.join() but after about 3000 connections, exception occurs: [Errno 10055] An operation on a socket could not be performed because

thrift: changing from tSimpleServer to TNonblockingServer

流过昼夜 提交于 2019-12-05 23:27:11
I have a simple thrift server: shared_ptr<TProcessor> processor(new MyProcessor(handlerTrace)); shared_ptr<TServerTransport> serverTransport(new TServerSocket(port)); shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory()); shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory()); TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory); and able to connect with the following lines: boost::shared_ptr<TSocket> socket(new TSocket("localhost", port)); boost::shared_ptr<TTransport> transport(new TBufferedTransport(socket)); boost

multiple requests in a single connection?

假装没事ソ 提交于 2019-12-05 23:01:10
Is it possible to put multiple requests without breaking the connection using python httplib?. Like, can I upload a big file to the server in parts but in a single socket connection. I looked for answers. But nothing seemed so clear and definite. Any examples/related links will be helpfull. Thanks. Yes, the connection stays open until you close it using the close() method. The following example, taken from the httplib documentation , shows how to perform multiple requests using a single connection: >>> import httplib >>> conn = httplib.HTTPConnection("www.python.org") >>> conn.request("GET", "

What is the `connection` parameter of MapperExtension in sqlalchemy?

◇◆丶佛笑我妖孽 提交于 2019-12-05 22:54:41
The class MapperExtension has some methods, and before_insert , before_update , ... all have a parameter connection . def before_insert(self, mapper, connection, instance): I've read the documents of MapperExtension , but found nothing about this connection . What is it? And how to use it? Denis Otkidach It's an instance of Connection class . Recent versions of SQLAlchemy distribution have examples directory, see examples/nested_sets/nested_sets.py to get an idea on how to use it in mapper extension. 来源: https://stackoverflow.com/questions/3646773/what-is-the-connection-parameter-of

Are Open and Closed only relevant values of ConnectionState enumeration?

一曲冷凌霜 提交于 2019-12-05 22:54:37
The MSDN page on ConnectionState enumeration says "This value is reserved for future versions of the product", for all values except Open and Closed. What does that mean? Are other values even used? However from this StackOverflow answer appears that ConnectionState.Broken is also used. After spending some time in Reflector, it looks to me like the Broken and Fetching states are also used in at least one or two places. The best coding practice would be to assume that any of the values might be used, and code defensively. For instance, if you need to know if the connection is open, check for

ftp doesn't download the file properly in java?

ぐ巨炮叔叔 提交于 2019-12-05 22:18:45
问题 When i download file with following code it just write the file to destination on local but file size are all zero. Can anybody say Why this happen and how to fix it? import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import java.io.FileOutputStream; import java.io.IOException; public class FtpDownload { public static void main(String[] args) { FTPClient client = new FTPClient(); FileOutputStream fos = null; String filename = "config.zip"; try { client

How do I set up Glassfish to go via a proxy server?

China☆狼群 提交于 2019-12-05 22:16:43
I have been having issues with running a Glassfish v2.1.1 instance on my local machine from within the office, where we have a proxy server for outgoing connections. My initial workaround has been to work from home. I am calling a SOAP service on a HTTPS server outside of the company. As Glassfish is not going via the company's proxy server, I get the following error when trying to initialise my SOAP clients: javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://www.hostname.com... and Caused by: java.net.UnknownHostException: www.hostname.com I have proxy environment

Handle lost connection to mongo db from nodejs

末鹿安然 提交于 2019-12-05 22:08:12
问题 I'm trying to get "connection lost" or something similar when connection lost between nodejs and mongodb server. I use native driver and has following code var mongo = require('mongodb'); var server = new mongo.Server('host', 'port', { auto_reconnect: true, socketOptions: { keepAlive: 10, connectTimeoutMS: 1000, socketTimeoutMS: 0 } }); var db = new mongo.Db( 'dbname', server, { w: 1, wtimeout: 1000, numberOfRetries: 100, auto_reconnect: true } ); db.on('close', function () { console.log(

Connection to Oracle works through a console application and doesn't work through a web service

为君一笑 提交于 2019-12-05 20:54:16
I can't connect to an Oracle schema through a asmx web service instead of I can through a console application [x86]. The code: var conn = new OracleConnection("Data Source=xe;User ID=mySchema;Password=myPass"); The exception: ORA-12154: TNS:could not resolve the connect identifier specified The environment: Windows 7 x64 - VS 2008. Any idea? kindly ask me for any extra information Thanks in advance. OCI, the Oracle client layer on which ODP (or the native Oracle client layer) is based has a bug that prevents any application located in a folder containing parentheses () from running properly