x


Performance Question MySQL

Hello, I have a server with a Mysql Database.

Every time an users logged in, create account, loosing life, .. the server is opening a mysql connection, execute mysqlcommand, close connection.

Now I think this isnt needed and I want to open the mysql connection 1 Time and close the connection only when server is turned off.

So is it a good idea to leave the mysql connection opened? (Does it get timeouts sometimes?) Or is it a better way to connect/disconnect for every command? Same question goes to the Mysql Reader (Ive expected some bugs when dont turn off the reader every time)

Here is my current code: Thanks

public class mysqlconn : MonoBehaviour{
//Define connection (new MySqlConnection)
}

function 1{open connection, execute, close connection}
function 2{open connection, execute, close connection}
more ▼

asked Jun 29 '10 at 03:21 PM

Tobias gravatar image

Tobias
393 50 54 66

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

After looking around I found on stackoverflow recommendation to close the connection for effeciency. Google is your friend.

stackoverflow

more ▼

answered Jul 03 '10 at 11:51 AM

TaigaStudios gravatar image

TaigaStudios
242 3 4 16

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5273
x678
x104

asked: Jun 29 '10 at 03:21 PM

Seen: 1096 times

Last Updated: May 31 '11 at 08:00 PM