mabaomsi Posted September 30, 2017 Posted September 30, 2017 (edited) Hi, i'm Balázs form Hungary, and i have a question for YOU ALL! I have a application with a HeliHost MySQL ONLINE database. I created a table in my database for users (username, pass, join date etc...), that can register for my program (in my program). After register, the user become a new line with all the data, which there has entered under the registration (username, pass, join date etc...) in my user database. The users can login in to my program, using this "user".The user enter there username and pass, and if this datas are correct, "READING data from user table", than the user can sucess login. So, the login was sucessfully, the user entered my program. And now it's coming the problem. This program is for it, to have datas (veichles, objects, addons, and for all donwload links etc...) about a simulator game (OMSI 2), and to help the users, finding fastest a component form this simulator game, that he/she wants. So i have more tables, in my ONLINE database. BUT, i use all the time one, my account (admin) to handle, manage, read etc... the database.When MORE (!!!) users, IN THE SAME TIME want to recive, change datas for example: login, account making, searching/looking for component in a table, coming my problem: ..."user already has more than 'max_user_connections' active connections!" So, the problem can be, that i make all the requests with my ONLY one MySQL account: admin? I need to make users in the Cpanel, when a user register in my program, i need to make all the time a new user in my Cpanel too? And when yes, HOW? It is possible to acces Cpnael with vb.net code, form source, like the MySQL databases? Thanks, and a good afternoon for all!Balázs Lengyel Sorry for my REALLY bad english! Edited September 30, 2017 by mabaomsi
mabaomsi Posted October 1, 2017 Author Posted October 1, 2017 Hi, no, i think no. I open one connection again, when a new action is coming. Like: new command, reader... ("Mysqlconn.open") So, i have more win. forms, in there i open another connnevtions, and when i use a sqlreader, the system saids you have soon opened a reader, you need one another connection to open a new again.
Krydos Posted October 2, 2017 Posted October 2, 2017 The reason I asked about persistent connections is because when people forget the close their mysql connections in their code they end up seeing that error.
mabaomsi Posted October 2, 2017 Author Posted October 2, 2017 Aham, so can I open endless connections? But i dont thik so. When I used ONLY the app, the error didn`t happend, BUT when we (I and my friends, for example) open a "table" / connection in the same time, the error comes... So I cant have more than 2 connections in the same time, with my ONLY, one Cpanel (MySQL accesed) account, for ex. a (primary) "admin" account.
Krydos Posted October 2, 2017 Posted October 2, 2017 Aham, so can I open endless connections?No. I have no idea where you got that from. We limit the number of mysql connections each account is allowed to have open at once to prevent the mysql software from becoming overloaded and blocking everyone else on your server from being able to connect to mysql. But i dont thik so. When I used ONLY the app, the error didn`t happend, BUT when we (I and my friends, for example) open a "table" / connection in the same time, the error comes... So I cant have more than 2 connections in the same time, with my ONLY, one Cpanel (MySQL accesed) account, for ex. a (primary) "admin" account.Ok, so say your scripts use 3 persistent connections per user. If there is one user then you have 3 open connections at any time. If you have 2 users then you have 6 persistent connections open at once and you get the error. We have accounts on our servers that have hundreds of simultaneous users and since their code closes their connections they don't see that error.
mabaomsi Posted October 3, 2017 Author Posted October 3, 2017 Huh,so i need to close all the connection all the time? Or what? 😆😆 But i maked so my script before the error comes, i had 10-20 different connections (but, with the same, admin account, and database), that i forever closed(/conn.). So the essence is, that i can't have more active connections for my database FROM DIFFERENT IP addresses? (Sorry, but dont really understand, how i need to change my scripts...)
Krydos Posted October 4, 2017 Posted October 4, 2017 Try something like this thenMySQLConnection = New MySqlConnection("server=johnny.heliohost.org; user id=maba_user; password=password123; database=maba_db") MySQLConnection.Open() ' query MySQLConnection.Close()
mabaomsi Posted October 5, 2017 Author Posted October 5, 2017 Yeah, my code seem like perfectly this. And from this Open/query/Close statement have i really a lot. But all connection with one maba_user. So and this is the error query, the account maba_user dont allow to have more connections from another computers with another IP-s. I think that is the problem.
Krydos Posted October 5, 2017 Posted October 5, 2017 It sounds like you are probably experiencing connection pooling then. Visual Basic tries to "improve" performance by keeping connections open for 4-8 minutes even after you explicitly close them in case you use them again. You should be able to disable connection pooling like thisPublic Shared Sub ClearAllPools Source: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.clearallpools(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
mabaomsi Posted October 7, 2017 Author Posted October 7, 2017 (edited) Ok i try it. Edited October 7, 2017 by mabaomsi
mabaomsi Posted October 14, 2017 Author Posted October 14, 2017 I see, its for my sqlconnection. SQLconn.ClearAllPools.But it isnt maked any changes, i cant connect to my database in the same time with the same account from different IP asresses.
Krydos Posted October 14, 2017 Posted October 14, 2017 I think you're running into a limitation of the language you're using at this point. My two suggestions that I can think of now is to try another language that will allow you to properly close your mysql connections or create a different mysql user for each client that you want to connect to your database.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now