Disconnect dialup connections after 1 hour - ACS (Radius)
Hello All,
I need to disconnect dialup users after 1 hour - limit session. Using ACS 3.3 RADIUS config. Looking at the RADIUS attribute [027] Session-Timeout to do this. ACS documentation indicates this does not support PPP sessions. However this link http://www.cisco.com/en/US/tech/tk59/technologies_configuration_example09186a0080094671.shtml#hw
indicates it can.. I am goint to test but thought I'd put it here in case anyone has this working.
Tested and working fine :-)
Similar Messages
-
Printer loses wireless connection after some hours
Hello to all!
Printer is connected and I can see on the screen correct IP. Desktops with Win7 and Ubuntu are used. After switching on printer works properly, but several hours later its unreachable from both systems. Printer shows connection, I can see it in router web access tool, but it is unreachable. I have to switch off printer, reboot the router, then switch on printer - and it works. Not very comfort.
Does anybody know how to fix this bug?
This question was solved.
View Solution.Hi @varspb,
Welcome to the HP Forums!
I noticed that your HP Deskjet Ink Advantage 6525 printer is losing wireless connection after some hours with Windows 7 and Ubuntu. I am happy to look into this connection issue for you!
For Linux support, please take a look at this website, http://hplip.sourceforge.net/.
Otherwise, please see the following guides:
HP Single-Function and Multifunction Printers - 'Printer is offline' Message Displays on the Compute....
HP Deskjet Ink Advantage 6520 e-All-in-One and HP Photosmart 6520 e-All-in-One Printer Series - Prin....
Tips for preventing wireless connection issues
The following tips can help prevent wireless connection issues:
Move the printer and the computer or access point (router) closer together.
Remove any metal objects between the printer and the computer or access point (router). Objects such as refrigerators or metal bookcases can interfere with wireless transmission.
Move any device that emits radio signals farther away from the printer. Devices such as microwaves and cordless telephones can interfere with wireless transmission.
Consult the router manufacturer for updates and configuration of your router.
Make sure that your computer is not connected through a VPN. You cannot access your printer on your wireless network while connected to a VPN.
Also, please take a look at this website, HP Wireless Printing Center - Troubleshooting Issues.
Hope this helps, and have a good day!
RnRMusicMan
I work on behalf of HP
Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
Click the “Kudos Thumbs Up" to say “Thanks” for helping! -
Trying to restore, I've tried a dozen networks and I keep getting a "lost connection" after an hour or two, EVERYTIME. Using Cox Wi-fi with a netgear 300 router. Any suggestions?
Thanks, helped me figure out a bigger problem there was with my router's access control and all kinds of crazy numbers that needed to be changed, but I got it.
Problem is fixed as far as I can tell! -
Question
I am trying to update Firefox per its suggestion, but haven't been able to connect to server. Keeps saying "connecting to server", but no connection after an hour of trying.Try running the combo update.
10.9.5 Combo Update -
Flash app disconnects from FMS after an hour
I have developed a Flash chat for a client using FMS2. The
application is used by goups of 5-15 people, who will use it for up
to 2 or 3 hours in one session, sometimes even longer.
Many of our users are complaining that they consistently get
disconnected after about an hour. They can usually log back in
immediately. Are there any known issues with connections being
lost?
A second problem I'm facing is that periodically my entire
interface(AS2, SWF7) stops interacting properly. No user
input(click actions, text input) is received, and several animation
scripts stop updating. However, the application is still connected
and new messages are received. Again, users report this behavior
consistently after an hour. I know that is an extremely ambiguous
problem, but I've been going crazy trying to isolate the problem,
if anyone has even a guess, I'm all ears.
A few facts about the chat:
- It uses a persistent RSO to store chat history
- Chat messages are sent from client to server, and processed
by server and put in the chat RSO
- User listing and info is in an RSO, which is created by
ther server and modified by the clients. It is modified frequently
by all clients when they type, setting a "isTyping" flag to be
rendered by their name on each clients user list window
- I'm using a complex custom message renderer, which includes
emoticon support and dynamic attach/removal of message clips when
scrolled(to prevent application slow down as the chat history gets
long).
- Our users I believe are are using somewhat older computer
equipment, and are fairly minimal in computer literacy/experience.
Any help would appreciated.I solved my interface problem. Long story short I
accidentally had an endless loop in teh suers RSO that was causing
focus to be constantly stolen and placed on a certain textfield.
However, I'd still be interested to know if there are any
problems with connections dying after an hour, or any amount of
time. -
WRT54G v.6 loses wired/wireless connection after 2 hours
I have been trying for two weeks to get my router to maintain connection to both my wired and wireless computers. It drops after 2 hours. It says it is connected but I can't get anywhere. I have DSL with a static address. I put the static IP on the router and have the router DHCPing to the others. Have "live chatted" with Lynksys 4 different times with no luck. Based on live-chat advice, I have updated the firmware to 1.01, and changed the MTU from 1500 to various other numbers with no positive results. Both computers drop at the same time. If I take the router out of the loop and plug straight into the DSL modem, it stays up forever. I run XP home on my wired computer and XP Pro on my wireless laptop. I am at my wits end and would appreciate any help that you can offer.
It didn't like that either! I got to thinking about how it said that I was still connected but I couldn't get anywhere so I called my ISP today and had them double check my connection. The technician said that I was having abnormally high errors rates going out of my dsl (new, had it replaced recently) modem. He had me reset the modem, then reset the router, update my DNS numbers.......same thing, about 2 hours later, DROP! I have about decided that it is a problem between my dsl modem and router instead of my router and computers. For one thing, I reset everything during my lunch break. Back at work, right after lunch, I could ping my static IP on my router but, sure enough 2 hours later, I couldn't ping it despite my ISP saying I was connected. That leads me to believe my router doesn't like my modem or vice versa! Any other suggestions?
-
OsX 10.5.4 Drops PC Network connections after several hours
Recently update G5 to OSX 10.5.4 and find that our connection to the office pc network gets dropped after a few hours. Before it was fine. Not sure if problem is linked to the fact that we need to use the Go 'connect to server' in order to connect to our pc server. Once connected the shared connections on the left pane in finder are operable. I recall this is a reported bug.
Thanks for any suggestions*UPDATE :*
Since I isolated the issue to just the Mac on the network, i thought it I should test if it affected all macs and OS versions.
Here are my conclusions:
Power Mac G5 running 10.5.8 -> Drops Connection after NTP Sync
Mac Book Pro running 10.6.4 -> Drops Connection after NTP Sync
Mac Book Pro running 10.6.4 (wireless) -> Drops Connection after NTP Sync
Any ideas ?
~D -
HT1218 Airport Time Capsule losing internet connection after 3 hours
I just got a Time Capsule and my internet connection seems to time out after 3 hours or so. My macbook/iphones/ipad seem to still connect to the internet but there is no internet connection. The only fix seems to be unplugging the modem every 3 hours. I think I have the most updated systems on everything. Does anyone know what I need to do?
Hi there Tharv23,
You may want to reset your base station to factory settings as an inital troubleshooting step. Take a look at the article below for more information.
Resetting an AirPort base station FAQ
http://support.apple.com/kb/ht3728
iOS and OS X: Recommended settings for Wi-Fi routers and access points
http://support.apple.com/kb/ht4199
-Griff W. -
Wired 802.1x re-authentication passes but no connectivity after 1 hour
I am testing wired 802.1x with the desired behavior of machine auth with user auth. I have a 6509 CAT OS 8.3(5) using the dot1x global defaults, 2 laptops one is XP SP1 and XP SP2 both with AuthMode=1 and SupplicantMode=3 with windows update as of 02mar2005. Active Directory. ACS SE 3.2 using vlan assignment. Have tested PC and user in different vlans and it works fine.
1st observation:
The initial EAP authentication is good. Every hour there is an EAP request with a final result of success in the packet trace. The switch shows connected dot1x-123. The ACS log shows the passed re-authentication. Everything looks good but both laptops lose connectivity 1 hour after the first authorization. If I issue "set port dot1x initialize" or enable/disable the port the process starts over.
2nd observation:
I can connect with Remote Desktop. There are 2 EAP start frames then the port becomes unauthorized about a minute later.
Any ideas?No. I am still waiting on Cisco to address the 1st observation. Does it occur on your 6506 8.4(2). I see it also in my 6509 with 8.4(2). I find it interesting that it works in my end of life 2948g switch 8.2(1)GLX.
The MS supplicant defaults for WIRED are authmode=1 and supplicantmode=2. Remote Desktop works in their default WIRED mode.
At this point I am content controlling machine access until dot1x matures. Cisco ACS has a machine access restriction feature that authorizes the port after a successful User Auth. I have found if enabled, a successful Machine Auth will be unauthorized when logged in with a local account. If disable the local account is authorized b/c MA has only occurred. -
PC disconnects from VPN after several hours, can't reconnect until PC reboot.
Hi,
I started using a private VPN for video gaming in general since last month, but I've started running into a problem I cannot fix... my PC tends to disconnect from the VPN after a while (6~12 hours of use?) and I can't reconnect to any VPNs until I reboot my
PC.
However.. my normal internet connection seems to work fine.
When I try to reconnect to the VPN after I get dropped, I'm welcomed by this error:
http://puu.sh/bicqT/0a6f1f8537.png
I'm on Windows 7 64bit and I use the default windows VPN client... idk what's it called, it's what you setup in the network and sharing center.
I've tried the following things:
*restart network adapter
*diagnose the issue with windows 7 network diagnostics
*/flush DNS cache
*/release and /renew lease
*reset internet connection
*using a neighbor's internet connection and I'm still unable to connect to any VPN until PC reboot.
-- diagnosing the wireless adapter after the disconnect from VPN happens leads to this...
http://puu.sh/bibQs/9873c02068.png
http://puu.sh/bibn7/93ec6f0934.png
http://puu.sh/biboF/3c9f865f15.png
http://puu.sh/bibpw/b204c59f01.png
http://puu.sh/bibq9/a10d3246d1.png
I cannot repair it through diagnostics.
Anyway, it's a problem on my end because I share the VPN with 2 other friends and they don't experience this problem... >_<
If there's any information missing, please tell me and I'll provide.
Thank you for any help!Hi,
could you tell me do you run more than one VPN connection on your PC?
Did you try to delete and re-configure the VPN?
What type of security software are you using? Any kind of software which might block the traffic or close the port in case it thinks that something fishy is going on?
Could you determine which manufacturer is your Wireless card, visit their website and download the latest drivers directly from their site. Or if you are using laptop, visit manufacturers website and download wireless drivers.
You can try to update the drivers manually.
What about that 'Enable logging' thingy? Can you enable it and when the next time disconnection happens, you might determine what is the exact issue with the VPN.
Please click on Propose As Answer or to mark this post as and helpful for other people. This posting is provided AS-IS with no warranties, and confers no rights. -
Hi,
In WebdynPro Application without using Adaptive RFC, we are able to disconnect a connection after few seconds as we using disconnect() method for that.
But for a WebdynPro Application using Adaptive RFC, we are not able to disconnect a connection as fast as we were able to do in first case.
We are using following to disconnect:
wdContext.currentInputElement().modelObject().modelInstance().disconnectIfAlive();
In SM04 transaction, we observed that the connection(Adaptive RFC) is taking more time to close than it is taking for without Adaptive RFC WD application. The connection still exists even the memory utilized becomes 0 MB.
Also, when we are not disconnecting in Adaptive RFC WD application, then memory is utilized as long as connection exists. But, when we are disconnecting the connection, the memory utilized is 0 MB though the connection still exists.
While creating the JCo connection for metadata and modeldata we gave:
Max pool size : 5
Max connection: 1000
Connection Timout (msec.) : 1000
Maximum Waiting Time (msec.): 5000
Can anybody suggest how to disconnect the connection to overcome above problem?
Thanks and Regards,
VaibhavHi
Check this URL
Actually The Connection will be Terminated when it is inactive for particular time
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/85a483cb-0d01-0010-2990-c5168f01ce8a">Jco Connection Pools</a>
Regards
Chandran S -
I recently connected my iPhone 3GS to my computer, for the new update 3.4.5, but i didn't load at all. Not even after 3 hours..
so i tried to disconnect the phone, but the loading meter is still there like it's frozen can't push any button or anything at all.. what should i do?Restart your iPhone by holding down the on/off and home buttons until your see the Apple logo.
-
Using database connection in a servlet and get errors after 8 hours
Hey,
I'm running a poker script using applet/servlets and it works great. But for some reason about about 8 hours that database layer stops working. At first I thought it was the connections to mySQL that were timing out (because im using connection pooling) but after turning pooling off (I now create the connection each time) I'm still seeing that same error (I can create a connection but when I do an action ex. like a select statment I get an error). What i'm wondering could it be that the driver I load with Class.forName() some how unloads it's self after x amount of time not being used? Not sure if that is it but if anyone could give me some insight that would be great. The Error i recieve is below:
INFO: Database Event:DatabaseController: Error executing database query.
ERROR: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: Software caused connection abort: recv failed
STACKTRACE:
java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:104)
at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:144)
at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:172)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1839)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2288)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2784)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2370)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2297)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:1183)
at com.softnet.database.DatabaseController.executeDatabaseQuery(DatabaseController.java:190)
at com.softnet.games.GameServer.validateUser(GameServer.java:438)
at com.softnet.games.GameServer.handleData(GameServer.java:113)
at com.softnet.network.HttpConnectionThread.run(HttpServletListener.java:191)
** END NESTED EXCEPTION **
I know the query is good because it works all other times just not after about 8 hours.
--Z3r0CooLHey,
Thanks for the responces. For the connection pooling I would open 5 connections and keep them open. So i though maybe after 8 hours after not being used they would timeout. Thats why i turned off conection pooling and create a new connection each time. Anyways i'll post the code below incase i made a mistake somewhere.
package com.softnet.database;
/************************ DatabaseControler **************************/
import java.sql.*;
import java.util.*;
import com.softnet.database.DatabaseConnectionPool;
import com.softnet.database.DatabaseSettings;
public class DatabaseController
implements DatabaseListener
//Used to make sure the database driver is loaded
private boolean databaseDriverState = false;
//Used to store a database connection
private Connection databaseConnection = null;
//If to user connection pooling or not
private boolean useConnectionPooling = false;
//Used to hold the connection pool varible
private DatabaseConnectionPool connectionPool = null;
//Used to store database settings
private DatabaseSettings databaseSettings;
//Used to hold the DatabaseController listeners
private List databaseControllerListeners = new ArrayList();
//min number of connections for connection pool
private int minNumberOfConnections = 1;
//max number of connections for connection pool -1 is unlimited
private int maxNumberOfConnections = -1;
//DatabaseController Constructors
public DatabaseController(DatabaseSettings databaseSettings)
this.databaseSettings = databaseSettings;
databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
public DatabaseController(DatabaseSettings databaseSettings, boolean useConnectionPooling, int minNumberOfConnections, int maxNumberOfConnections)
this.databaseSettings = databaseSettings;
this.useConnectionPooling = useConnectionPooling;
this.minNumberOfConnections = minNumberOfConnections;
this.maxNumberOfConnections = maxNumberOfConnections;
if(useConnectionPooling == true)
connectionPool = new DatabaseConnectionPool(databaseSettings, minNumberOfConnections, maxNumberOfConnections);
connectionPool.addDatabaseListener(this);
else
databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
public DatabaseController() {}
//Database Settings Get/Set
public DatabaseSettings getDatabaseSettings()
return databaseSettings;
public void setDatabaseSettings(DatabaseSettings databaseSettings)
this.databaseSettings = databaseSettings;
//Connection Pooling Get/Set
public boolean getConnectionPooling()
return useConnectionPooling;
public void setConnectionPooling(boolean useConnectionPooling, int minNumberOfConnections, int maxNumberOfConnections)
this.useConnectionPooling = useConnectionPooling;
this.minNumberOfConnections = minNumberOfConnections;
this.maxNumberOfConnections = maxNumberOfConnections;
if(useConnectionPooling == true)
if(connectionPool == null)
connectionPool = new DatabaseConnectionPool(databaseSettings, minNumberOfConnections, maxNumberOfConnections);
connectionPool.addDatabaseListener(this);
else
if(connectionPool != null)
connectionPool.destroyConnections();
connectionPool.removeDatabaseListener(this);
connectionPool = null;
//Return if there connected
public boolean isConnected()
boolean isConnected;
if(databaseConnection != null)
isConnected = true;
else
isConnected = false;
return isConnected;
//Used to connect to database or get a connection for the connection pool
public void connect()
if(databaseDriverState == false)
databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
//If we dont have a current connection, make one
if(databaseConnection == null && databaseDriverState == true)
if(useConnectionPooling == false)
try
databaseConnection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
catch (SQLException sqle)
//Raise event
raiseDatabaseEvent("DatabaseController: Error connecting to database. \nERROR: " + sqle.getMessage());
databaseConnection = null;
else
databaseConnection = connectionPool.getConnection();
//Used to disconnect from the database or give back the connection to the connection pool
public void disconnect()
if(databaseConnection != null)
if(useConnectionPooling == false)
try
//Close DB Connection
databaseConnection.close();
catch(SQLException ignore) {}
finally
databaseConnection = null;
else
connectionPool.returnConnection(databaseConnection);
databaseConnection = null;
public ResultSet executeDatabaseQuery(String sSQL)
ResultSet databaseResult = null;
if(databaseConnection != null)
try
Statement databaseStatement = databaseConnection.createStatement();
databaseResult = databaseStatement.executeQuery(sSQL);
catch(SQLException sqle)
//Raise event
raiseDatabaseEvent("DatabaseController: Error executing database query.\nSQL: " + sSQL + "\nERROR: " + sqle.getMessage());
return databaseResult;
public int executeDatabaseUpdate(String sSQL)
int rowsAffected = -1;
if(databaseConnection != null)
try
Statement databaseStatement = databaseConnection.createStatement();
rowsAffected = databaseStatement.executeUpdate(sSQL);
catch(SQLException sqle)
//Raise event
raiseDatabaseEvent("DatabaseController: Error executing database update.\nSQL: " + sSQL + "\nERROR: " + sqle.getMessage());
return rowsAffected;
//Used to load the Database Driver
private boolean loadDatabaseDriver(String databaseDriver)
boolean driverLoaded;
if(databaseDriver.equals("") == false)
try
//Load Database Driver
Class.forName(databaseDriver).newInstance();
driverLoaded = true;
catch (Exception e)
//Raise event
raiseDatabaseEvent("DatabaseController: Error loading database driver. \nERROR: " + e.getMessage());
driverLoaded = false;
else
driverLoaded = false;
return driverLoaded;
//Wrap the DatabaseConnectionPool Error to the DatabaseController
public void databaseEventOccurred(DatabaseEvent de)
raiseDatabaseEvent(de.getErrorMessage());
//Event Handling Code
//Used to add database listeners (Its sync'd so you can change the listeners when firing an event)
public synchronized void addDatabaseListener(DatabaseListener databaseControllerListener)
databaseControllerListeners.add(databaseControllerListener);
//Used to remove a listener from the list (Its sync'd so you can change the listeners when firing an event)
public synchronized void removeDatabaseListener(DatabaseListener databaseControllerListener)
databaseControllerListeners.remove(databaseControllerListener);
//Used to send the raise event to the listeners
private synchronized void raiseDatabaseEvent(String databaseError)
DatabaseEvent databaseEvent = new DatabaseEvent(this, databaseError);
Iterator listeners = databaseControllerListeners.iterator();
while(listeners.hasNext())
DatabaseListener listener = (DatabaseListener) listeners.next();
listener.databaseEventOccurred(databaseEvent);
/********************* DatabaseConnectionPool **************/
package com.softnet.database;
import java.io.*;
import java.sql.*;
import java.util.*;
import com.softnet.database.*;
import com.softnet.database.DatabaseSettings;
public class DatabaseConnectionPool
//min number of connections
private int minNumberOfConnections = 1;
//max number of connections -1 is unlimited
private int maxNumberOfConnections = -1;
//Store the connections
protected Hashtable databaseConnections = null;
//Database Info
protected DatabaseSettings databaseSettings;
//to hold Driver state
private boolean databaseDriverState = false;
//To hold connection checker
private DatabaseConnectionCheck connectionChecker = null;
//Used to hold the DatabaseConnectionPool listeners
private List databaseConnectionPoolListeners = new ArrayList();
public DatabaseConnectionPool(DatabaseSettings databaseSettings, int minNumberOfConnections, int maxNumberOfConnections)
this.databaseSettings = databaseSettings;
this.minNumberOfConnections = minNumberOfConnections;
this.maxNumberOfConnections = maxNumberOfConnections;
//Load Driver
databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
//Create connection
createConnections();
public DatabaseConnectionPool(int minNumberOfConnections, int maxNumberOfConnections)
this.minNumberOfConnections = minNumberOfConnections;
this.maxNumberOfConnections = maxNumberOfConnections;
//Database Settings Get/Set
public DatabaseSettings getDatabaseSettings()
return databaseSettings;
public void setDatabaseSettings(DatabaseSettings databaseSettings)
this.databaseSettings = databaseSettings;
//Driver State Get
public boolean getDatabaseDriverState()
return databaseDriverState;
public void createConnections()
if(databaseDriverState == false)
databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
//Create all connections and load the minimum in the Hashtable
if(databaseConnections == null)
if(databaseDriverState == true && minNumberOfConnections != 0)
databaseConnections = new Hashtable();
for(int i = 0; i < minNumberOfConnections; i++)
try
databaseConnections.put(DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword()), Boolean.FALSE);
catch(SQLException sqle)
//Problem break loop and destroy any connections
destroyConnections();
//Raise event
raiseDatabaseEvent("DatabaseConnectionPool: Error creating database connections. \nERROR: " + sqle.getMessage());
break;
//If no connection check exists create one
if(connectionChecker == null)
connectionChecker = new DatabaseConnectionCheck(this);
connectionChecker.start();
public Connection getConnection()
Connection connection = null;
boolean errorWithConnection = false;
Enumeration connections = databaseConnections.keys();
synchronized (databaseConnections)
while(connections.hasMoreElements())
errorWithConnection = false;
connection = (Connection) connections.nextElement();
Boolean state = (Boolean) databaseConnections.get(connection);
//If connection is not used, use it.
if(state == Boolean.FALSE)
try
connection.setAutoCommit(true);
catch(SQLException e)
//Problem with connection remove connection and replace it
databaseConnections.remove(connection);
try
connection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
catch(SQLException sqle)
errorWithConnection = true;
if(errorWithConnection == false)
// Update the Hashtable to show this one's taken
databaseConnections.put(connection, Boolean.TRUE);
// Return the connection
return connection;
//All connections being used check to max to see if we can make a new one
if(maxNumberOfConnections == -1 || maxNumberOfConnections > databaseConnections.size())
try
connection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
catch(SQLException sqle)
errorWithConnection = true;
if(errorWithConnection == false)
databaseConnections.put(connection, Boolean.TRUE);
return connection;
//If not connections free and max connections reached wait for a free connection
return getConnection();
public void returnConnection(Connection connection)
boolean errorWithConnection = false;
//Make sure connection still works
try
connection.setAutoCommit(true);
catch(SQLException e)
//Problem with connection remove connection and replace it
databaseConnections.remove(connection);
try
connection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
catch(SQLException sqle)
errorWithConnection = true;
if(errorWithConnection == false)
databaseConnections.put(connection, Boolean.FALSE);
public void destroyConnections()
Connection connection = null;
if(databaseConnections != null)
//Close all connections
Enumeration connections = databaseConnections.keys();
while (connections.hasMoreElements())
connection = (Connection) connections.nextElement();
try
connection.close();
catch(SQLException ignore) {}
//Free up hashtable
databaseConnections = null;
private boolean loadDatabaseDriver(String databaseDriver)
boolean driverLoaded;
if(databaseDriver.equals("") == false)
try
//Load Database Driver
Class.forName(databaseDriver);
driverLoaded = true;
catch (ClassNotFoundException cnfe)
//Raise event
raiseDatabaseEvent("DatabaseController: Error loading database driver. \nERROR: " + cnfe.getMessage());
driverLoaded = false;
else
driverLoaded = false;
return driverLoaded;
//Event Handling Code
//Used to add database listeners (Its sync'd so you can change the listeners when firing an event)
public synchronized void addDatabaseListener(DatabaseListener databaseConnectionPoolListener)
databaseConnectionPoolListeners.add(databaseConnectionPoolListener);
//Used to remove a listener from the list (Its sync'd so you can change the listeners when firing an event)
public synchronized void removeDatabaseListener(DatabaseListener databaseConnectionPoolListener)
databaseConnectionPoolListeners.remove(databaseConnectionPoolListener);
//Used to send the raise event to the listeners
private synchronized void raiseDatabaseEvent(String databaseError)
DatabaseEvent databaseEvent = new DatabaseEvent(this, databaseError);
Iterator listeners = databaseConnectionPoolListeners.iterator();
while(listeners.hasNext())
DatabaseListener listener = (DatabaseListener) listeners.next();
listener.databaseEventOccurred(databaseEvent);
class DatabaseConnectionCheck extends Thread
private DatabaseConnectionPool connectionPool;
DatabaseConnectionCheck(DatabaseConnectionPool connectionPool)
this.connectionPool = connectionPool;
public void run()
try
while(true)
//check threads every 30 seconds
this.sleep(300000);
if(connectionPool.databaseConnections != null)
Connection connection = null;
Enumeration connections = connectionPool.databaseConnections.keys();
synchronized (connectionPool.databaseConnections)
while(connections.hasMoreElements())
connection = (Connection) connections.nextElement();
Boolean state = (Boolean) connectionPool.databaseConnections.get(connection);
//If connection is not used, use it.
if(state == Boolean.FALSE)
try
connection.setAutoCommit(true);
catch(SQLException e)
//Problem with connection remove connection and replace it
connectionPool.databaseConnections.remove(connection);
try
connection = DriverManager.getConnection(connectionPool.databaseSettings.getDatabaseURL(), connectionPool.databaseSettings.getUserName(), connectionPool.databaseSettings.getUserPassword());
catch(SQLException sqle)
connection = null;
// Update the Hashtable with new connection if its not null
if(connection != null)
connectionPool.databaseConnections.put(connection, Boolean.FALSE);
catch(InterruptedException ignored) {}
Basicly the why it works is the connection pool hold the database connections. When the user needs a connection they use the database controller to request a connection (By create a instance and called the connect() method) and the connection is either created or grabed from the connection pool. After the user is done with the connection they call the disconnect() method which closes the connection or returns it to the connection pool.
--Z3r0CooL -
Why does my phone disconnect after 4 hours of call time
why does my phone disconnect after 4 hours of call time? Is there anyway I can change this?
You mean that you're on a single call for 4 hours continously, and then it disconnects?
If so, contact your wireless carrier. That's a cellular connection issue. -
s there any problem for my iphone's battery to keep my charger connecting for few hours after the battery is full?
Sometimes i sleep and the my iphone is charging and of course the battery became full after two or three hours, and definitely i will not wake up in the midnight to just disconnect the charger, please i need your help.This is considered normal use. I think everybody does this, including myself. It's not something to worry about in the least bit.
Just remember to complete a full charge cycle (allow the phone's battery to discharge to 10%-20%, then charge uninterruped to 100%) once a month and you'll be fine.
http://www.apple.com/batteries/iphone.html
Maybe you are looking for
-
Error while loading shared libraries: libaio.so.1: cannot open share
Hi when i try to install Oracle Management Agent 11g using Deployment wizard to one of our hosts, it fails with the following error: error while loading shared libraries: libaio.so.1: cannot open shared object file: i have changed LD_LIBRARY_PATH to
-
Setting up Router E1200 on a computer that does not have an internet modem
I just bought a E1200 router and can not install the software because I do not have an internet modem. (I get my internet connection from ICS on my host computer -not the computer that I'm setting the modem up on.) Is there any way of setting up thi
-
Mapping constant block parameters in simulink to a Veristand control block
Hello, I am trying to take a simple model of a RL circuit in simulink (built a dll file) and add control of constant blocks in Veristand to dynamically change the value of R and L constant thru the Veristand Slider or Numerical indicator. I can see t
-
i want a program RMI with JDBC code included.
-
Must I uninstall my current version of CS6 before installing Creative Cloud PS app?
Also, Must I uninstall Lightroom 4 before installing CC Lightroom?