Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] WebSocketHandler or WebSocketListener - where to open JDBC connection

Are you sure you wouldn't prefer to use a connection manager of some sort?

I use Hibernate and c3p0 on my J2EE projects. c3p0 or something similar might work well for you.
 
--
Lobos Studios | Phone: 877.919.4WEB | LobosStudios.com | Facebook.com/LobosStudios | @LobosStudios
Web Development - Mobile Development - Helpdesk/Tech Support - Computer Sales & Service
Acer Authorized Reseller - Computers, Windows and Android Tablets, Accessories
 
Steve Sobol - CEO, Senior Developer and Server Jockey
steve@xxxxxxxxxxxxxxxx
 
 
 
------ Original Message ------
From: "Alexander Farber" <alexander.farber@xxxxxxxxx>
Sent: 6/4/2016 12:59:32 PM
Subject: [jetty-users] WebSocketHandler or WebSocketListener - where to open JDBC connection
 
Good evening,

I am working on a word game, moving it 
from AJAX/PHP to Websockets/Jetty. 
Most of code is in stored procedures for PostgreSQL anyway.

Being a Servlets and JDBC newbie I have a question please:


And a custom WebSocketListener similar to

where would you be opening JDBC connection?

I.e. where would you call code like

        Connection conn = DriverManager.getConnection("jdbc:postgresql://127.0.0.1/", props);

so that you could use it in onWebSocketConnect and onWebSocketText?

Maybe there is even some 3rd object in 
Jetty life cycle which would suit well?

Thank you
Alex

Back to the top