Professional Web Applications Themes

Better to login/out for each query? - MySQL

Is it better to log in or out for each query or log in and stay logged in for all queries? It would be easier for me to log in and out for each query but I'm worried that this might cause excessive overhead in the future. Thanks, Jon...

  1. #1

    Default Better to login/out for each query?

    Is it better to log in or out for each query or log in and stay logged in
    for all queries?

    It would be easier for me to log in and out for each query but I'm worried
    that this might cause excessive overhead in the future.

    Thanks,
    Jon


    Jon Guest

  2. #2

    Default Re: Better to login/out for each query?

    > Is it better to log in or out for each query or log in and stay logged in 

    Under windows: definitely not! There is an issue that ports remain open
    for a couple of minutes before they can be reused again. So you can run
    out of free ports...

    In general: I never even tried it, but I suspect it slows things down a
    bit. On the other hand, logging in into a mysql database is not that slow.
     

    Why? It is not that difficult to keep connection or connection wrapping
    objects in a variable. And as a programmer you are responsible to
    dispose of any resources you open. Even if PHP is a bit forgiving in
    this respect.

    Best regards.
    --
    Willem Bogaerts

    Application smith
    Kratz B.V.
    http://www.kratz.nl/
    Willem Guest

  3. #3

    Default Re: Better to login/out for each query?

    Jon Slaughter wrote: 

    there is no problem with staying logged on if your design and setup
    allows that.

    however, each time you log out and back in, understand that a thread is
    destroyed (hopefully explicitly by you but potentially implicitly by the
    server) and a new one is created.

    try to create some metrics and base your method on those metrics. mysql
    can and does a good job of either of these methods.

    --
    lark -- net
    To reply to me directly, delete "despam".
    lark Guest

  4. #4

    Default Re: Better to login/out for each query?

    *snip* 

    mysql might, but the other layers might not. I believe JDBC has
    substantial overhead obtaining a connection when not using connection
    pooling, but I may be mistaken.

    christopher@dailycrossword.com Guest

  5. #5

    Default Re: Better to login/out for each query?

    Jon Slaughter wrote: 

    Jon,

    If you're talking web access, on a single page it's definitely better to
    login before your first query and no log out until after your last query
    (within the same page, of course).

    For non-web-based languages, it all depends on just how often you need
    the info and what modules require it. Generally I only open one
    connection and close it between user interfaces.

    Just never keep a connection open while the user is contemplating his navel.

    --
    ==================
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    net
    ==================
    Jerry Guest

Similar Threads

  1. Replies: 4
    Last Post: September 18th, 11:58 PM
  2. SQL Query by login
    By Bret in forum ASP.NET Web Services
    Replies: 2
    Last Post: September 30th, 01:55 PM
  3. error executing database query on login
    By timrande in forum Coldfusion Database Access
    Replies: 0
    Last Post: August 19th, 04:33 PM
  4. Replies: 1
    Last Post: November 24th, 08:24 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139