Results 1 to 3 of 3
  1. #1
    mohsen.noor is offline Member
    Join Date
    Dec 2012
    Posts
    30
    Rep Power
    0

    Default Create database connection which accessible for all users

    Hi
    I want to create a database connection which open for all users AND I do NOT want every time open database connection for each access by user
    I think it should be done through ServletContext.But I do not how define classes and function and where invoke the database connection which open for all users at once.
    Thanks

  2. #2
    Join Date
    Apr 2014
    Location
    http://www.roytuts.com
    Posts
    51
    Rep Power
    0

    Default Re: Create database connection which accessible for all users

    create one servlet for creating database connection and load this servlet on startup of the application

  3. #3
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,989
    Rep Power
    8

    Default Re: Create database connection which accessible for all users

    Having one connection open all the time is bad practice and a waste of resources. Read up on connection pooling. Creating a database connectionpool is easy. All application servers like Tomcat support connection pooling out of the box. (https://tomcat.apache.org/tomcat-7.0...l#Code_Example).
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

Similar Threads

  1. cant create database connection
    By gvjoshi25 in forum NetBeans
    Replies: 3
    Last Post: 08-19-2011, 11:00 AM
  2. Get list of users logged on to database
    By Happyme in forum New To Java
    Replies: 0
    Last Post: 06-14-2011, 01:37 PM
  3. create users on the server site?
    By nakres in forum New To Java
    Replies: 2
    Last Post: 03-25-2011, 09:31 AM
  4. multiple users with single connection
    By nishi.kishore in forum Java Servlet
    Replies: 3
    Last Post: 09-06-2009, 03:15 PM
  5. How to log the users interactions with database in struts?
    By piterskiy in forum Web Frameworks
    Replies: 0
    Last Post: 07-28-2008, 09:49 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •