database-connection

Processing on MySQL query taking too long and throwing “Communications link failure”

拜拜、爱过 提交于 2019-12-29 07:46:15
问题 I issued a query using a JDBC connection: Connection conn = null Class.forName("com.mysql.jdbc.Driver") conn = DriverManager.getConnection(dbHost, dbUser, dbPass) s = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); s.setFetchSize(Integer.MIN_VALUE); r = s.executeQuery (MY_SELECT_QUERY); while(...) { processResultSet(r); } The while runs for a long time processing the ResultSet. After around 1 hour i got the exception: com.mysql.jdbc.exceptions

Connecting MySQL from JSP

拟墨画扇 提交于 2019-12-29 04:25:07
问题 I just set foot on JSP. I started writing simple programs to display dates, system info. Then I tried to connect a MySQL database I have a free hosting account, but I am not able to connect to MySQL database. Here is my code: <%@ page import="java.sql.*" %> <%@ page import="java.io.*" %> <html> <head> <title>Connection with mysql database</title> </head> <body> <h1>Connection status</h1> <% try { String connectionURL = "jdbc:mysql://mysql2.000webhost.com/a3932573_product"; Connection

Is Class.forName() mechanism needed? [duplicate]

旧时模样 提交于 2019-12-28 06:59:31
问题 This question already has answers here : Class.forName(JDBC_DRIVER) no longer needed? (2 answers) Closed 4 years ago . Following code: Class.forName(dbDriver); // "org.postgres.Driver" or "com.mysql.jdbc.Driver" is / was necessary to open JDBC connection. I have heard that it is no longer needed with modern JDBC drivers. However I can't remove it in my project, because I'm getting No suitable driver found exception. I am using postgresql-9.1-901.jdbc3.jar , Java7 and tomcat7. When can I omit

Is Class.forName() mechanism needed? [duplicate]

╄→гoц情女王★ 提交于 2019-12-28 06:59:28
问题 This question already has answers here : Class.forName(JDBC_DRIVER) no longer needed? (2 answers) Closed 4 years ago . Following code: Class.forName(dbDriver); // "org.postgres.Driver" or "com.mysql.jdbc.Driver" is / was necessary to open JDBC connection. I have heard that it is no longer needed with modern JDBC drivers. However I can't remove it in my project, because I'm getting No suitable driver found exception. I am using postgresql-9.1-901.jdbc3.jar , Java7 and tomcat7. When can I omit

A network-related or instance-specific error occurred while establishing a connection to SQL Server [closed]

青春壹個敷衍的年華 提交于 2019-12-27 17:39:09
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I deployed my asp.net web application on somee.com, whenever I login into this site (ipc.somee.com) it gives me a network related error like: A network-related or instance-specific error occurred while

Is there a timeout for idle PostgreSQL connections?

主宰稳场 提交于 2019-12-27 16:26:32
问题 1 S postgres 5038 876 0 80 0 - 11962 sk_wai 09:57 ? 00:00:00 postgres: postgres my_app ::1(45035) idle 1 S postgres 9796 876 0 80 0 - 11964 sk_wai 11:01 ? 00:00:00 postgres: postgres my_app ::1(43084) idle I see a lot of them. We are trying to fix our connection leak. But meanwhile, we want to set a timeout for these idle connections, maybe max to 5 minute. 回答1: It sounds like you have a connection leak in your application because it fails to close pooled connections . You aren't having

Is there a timeout for idle PostgreSQL connections?

时光怂恿深爱的人放手 提交于 2019-12-27 16:24:55
问题 1 S postgres 5038 876 0 80 0 - 11962 sk_wai 09:57 ? 00:00:00 postgres: postgres my_app ::1(45035) idle 1 S postgres 9796 876 0 80 0 - 11964 sk_wai 11:01 ? 00:00:00 postgres: postgres my_app ::1(43084) idle I see a lot of them. We are trying to fix our connection leak. But meanwhile, we want to set a timeout for these idle connections, maybe max to 5 minute. 回答1: It sounds like you have a connection leak in your application because it fails to close pooled connections . You aren't having

SQL Express connection string: mdf file location relative to application location

痞子三分冷 提交于 2019-12-27 10:26:11
问题 I am using SQL Express databases as part of a unit test project in c#. My databases is located here: ./Databases/MyUnitTestDB.mdf I would like to use a relative path or variable in the app.config rather than having my connection string defined as: AttachDbFilename=C:\blah\blah\blah\yea\yea\yea\MyApplication\Databases\MyUnitTestDB.mdf I have seen the use of |DataDirectory| but am I correct in thinking this is only applicable to web applications? I want to control this in the application

Getting connection from Connection Pool taking too much time in java

微笑、不失礼 提交于 2019-12-25 09:03:36
问题 I have a java based web application in which I have included the Connection Pooling method. Code is as follows : public final class Database { private static final String SQL_EXIST = "show tables;"; public static void main(String[] args) throws SQLException { // TODO Auto-generated method stub } private static final BasicDataSource dataSource = new BasicDataSource(); static { dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setUrl("jdbc:mysql://link"); dataSource.setUsername

Connecting c++ program with Oracle

落花浮王杯 提交于 2019-12-25 08:59:08
问题 I'm trying to connect my C++ program to Oracle database(12.2). My C++ program is (I am using g++ compiler in ubuntu), #include <occi.h> #include <iostream> using namespace std; int main() { oracle::occi::Environment *env = oracle::occi::Environment::createEnvironment(); oracle::occi::Connection *conn = env->createConnection("bsk", "oraclepass"); env->terminateConnection(conn); oracle::occi::Environment::terminateEnvironment(env); } I'm getting the error undefined reference to `oracle::occi: