connection

How to properly use try-with-resources in Database connection?

爷,独闯天下 提交于 2020-01-25 07:52:05
问题 I have looked around, but can't seem to find the answer to my question. Here is the context : I have to connect to a Database in my Java program and execute a SQL request that I have no control over and don't know in advance. To do that I use the code below. public Collection<HashMap<String, String>> runQuery(String request, int maxRows) { List<HashMap<String, String>> resultList = new ArrayList<>(); DataSource datasource = null; try { Context initContext = new InitialContext(); datasource =

Socket.io client-side reconnect not working

怎甘沉沦 提交于 2020-01-24 23:30:23
问题 I'm using Socket.io to communicate between my Node.js server and the client website. Everything works great! Except one thing. I'm allowing the user to disconnect from Socket.io and reconnect later, or at least I'm trying to. Keeping in mind that my socket from calling io() is stored in mySocket, disconnecting works fine using mySocket.io.disconnect() . The server catches it, the client knows it's disconnected, it's great. The issue is when I try to reconnect later... So at first I just tried

Laravel raw query using a specific connection

廉价感情. 提交于 2020-01-24 04:39:32
问题 i've been trying to query a moodle database and need to use DB::raw(). but it keeps trying to use the default mysql connection. here's the query i'd like to run. SELECT mdl_course.id, mdl_course.category, mdl_course.fullname, mdl_course_categories.name, mdl_enrol.cost, FROM_UNIXTIME(mdl_course.startdate, '%m/%d/%y') AS startdate FROM mdl_course LEFT JOIN mdl_course_categories ON mdl_course_categories.id = mdl_course.category LEFT JOIN mdl_enrol ON mdl_enrol.courseid = mdl_course.id AND mdl

Laravel raw query using a specific connection

给你一囗甜甜゛ 提交于 2020-01-24 04:39:05
问题 i've been trying to query a moodle database and need to use DB::raw(). but it keeps trying to use the default mysql connection. here's the query i'd like to run. SELECT mdl_course.id, mdl_course.category, mdl_course.fullname, mdl_course_categories.name, mdl_enrol.cost, FROM_UNIXTIME(mdl_course.startdate, '%m/%d/%y') AS startdate FROM mdl_course LEFT JOIN mdl_course_categories ON mdl_course_categories.id = mdl_course.category LEFT JOIN mdl_enrol ON mdl_enrol.courseid = mdl_course.id AND mdl

Connection between PHP and Access DB

旧巷老猫 提交于 2020-01-24 00:49:07
问题 I'm working for weeks to try to solve this problem. I need to manage a connection between PHP and Microsoft Access Database .mdb. My goal is to create a web page that contain a table with the fields of a database table. But my table has about 30 columns, I would like to insert only 6 of these. Example: Database name: DinamicoWeb Table name: Orders Fields name: Id Ord, Ord Date, Name, Surname, Price, Total This is the code that I managed to write(put inside ALL columns). config.php <?php

Connect Android application to remote data

三世轮回 提交于 2020-01-23 13:16:05
问题 Sheesh talk about limited information! I'm trying to get my Android application to connect to an online database to access information. There's quite a bit of info including geotags and these are going to be mapped on my app. The developer site has the very informative piece of information: You can use the network (when it's available) to store and retrieve data on your own web-based services. To do network operations, use classes in the following packages: java.net.* android.net.* Like I

Alternative to NetworkStream.Read that indicates remote host has closed the connection?

末鹿安然 提交于 2020-01-22 06:02:12
问题 With regards to handling a TCP/IP connection using the TcpClient class, is there an alternative for checking whether the remote host has closed the connection other than waiting for the NetworkStream.Read method to return a 0? 回答1: You can use IOControlCode.KeepAliveValues on the TcpClient.Client to guarantee that a keep-alive check is made at least on the specified interval and then check the TcpClient.Client.Connected property. An example how to use it: struct tcp_keepalive { public int

Alternative to NetworkStream.Read that indicates remote host has closed the connection?

佐手、 提交于 2020-01-22 06:01:08
问题 With regards to handling a TCP/IP connection using the TcpClient class, is there an alternative for checking whether the remote host has closed the connection other than waiting for the NetworkStream.Read method to return a 0? 回答1: You can use IOControlCode.KeepAliveValues on the TcpClient.Client to guarantee that a keep-alive check is made at least on the specified interval and then check the TcpClient.Client.Connected property. An example how to use it: struct tcp_keepalive { public int

Unexpected Connection Reset: A PHP or an Apache issue?

那年仲夏 提交于 2020-01-19 12:41:49
问题 I have a PHP script that keeps stopping at the same place every time and my browser reports: The connection to the server was reset while the page was loading. I have tested this on Firefox and IE, same thing happens. So, I am guessing this is an Apache/PHP config problem. Here are few things I have set. PHP.ini max_execution_time = 300000 max_input_time = 300000 memory_limit = 256M Apache (httpd.conf) Timeout 300000 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 0 Are the above

RabbitMQ Obj-C client connection status check

时光总嘲笑我的痴心妄想 提交于 2020-01-17 05:48:05
问题 I'm using rabbitmq/rabbitmq-objc-client. Is there a way how to check if connection was opened successfully? I see there is RMQConnectionDelegate but there are only methods that are called when an error appears. I'm looking for something like RMQConnection *conn = [[RMQConnection alloc] /*...*/]; if ([conn isOpen]) { /* ... */ } 回答1: You can do this: [conn start:^{ // code to execute when connection established }]; But note that the client is async and all channel operations are placed onto a