java - Microsoft Azure Database and Glassfish -


i have j2ee web application deployed on glassfish 4.0.1 want use windows azure database.

the application uses jpa , eclipselink.

if ping glassfish interface works, properties provide ok.

if application uses database after server started, goes (it can retrieve/store data)

when application tries use database after being idle while, exception saying connection closed.

if flush connection (from glassfish admin) starts work again, until goes idle period of time.

so basically, long executes database operations works well, if there no database operations while, next db operation result in exception.

i have found solution having hard time implementing it. can me please ?

here link of solution http://www.robblackwell.org.uk/2010/12/02/java-jdbc-to-sqlazure-connection-drop-workaround.html

or here https://msdn.microsoft.com/en-us/library/hh290696(v=sql.110).aspx

per experience, alternative way solve issue can create crontab listener using java schedule framework "cron4j" or "quartz" on java web application. crontab listener send simple query(like "select id t_xxx limit 1") interval less 1 minute keep database connection alive.


press ”windows+r” , run "regedit" . check registry keys "keepalivetime", "keepaliveinterval" , "tcpmaxdataretransmission" whether exist in registry tree path "hkey_local_machine\system\currentcontrolset\services\tcpip\parameters".

if not exist in path, need open cmd window administrator, , copy below commonds cmd window run them.

reg add hkey_local_machine\system\currentcontrolset\services\tcpip\parameters /v keepalivetime /t reg_dword /d 30000 reg add hkey_local_machine\system\currentcontrolset\services\tcpip\parameters /v keepaliveinterval /t reg_dword /d 1000 reg add hkey_local_machine\system\currentcontrolset\services\tcpip\parameters /v tcpmaxdataretransmission /t reg_dword /d 10 

then, can find them in regedit, , test issue.

best regards.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -