Walter1 8 Posted March 10, 2014 Report Share Posted March 10, 2014 Hey guys, I am really hoping someone would have a answer on this one since its really holding up the launch of my first BIG project. A bot of mine requires to first fetch the data from a mysql database on a dedi but for some reason it is not connecting.I tested the bot on 2 other servers and my home work laptop and there it works. What it makes even more stranger is that when i run navicat on the 'not connecting' VPS i DO get a succesfull connection... The database info i entered in navicat is copied from the bot so thats not the problem. Anyone encountered this before or have some tips? I don't want to migrate the whole shabam if its not needed but this is driving me nuts! Best regards botters! Walter Quote Link to post Share on other sites
blumi40 222 Posted March 10, 2014 Report Share Posted March 10, 2014 got this issue too sometime behind hma proxyseven if i pipe 3306 to 443 or 80 it is the same.best way here is to work with php serverside Quote Link to post Share on other sites
Walter1 8 Posted March 10, 2014 Author Report Share Posted March 10, 2014 Hi Blumi, thanks for the reply man. 'Glad' i am not the only one with the problem... I could do that indeed to show and scrape the data but thats not a option since i have to update specific rows in the DB on the fly wich makes things too complicated and not to mention BIGGER. Ill try to connect trough php now instead of the mysql commands trough ubot and/or plugins. Maybe that will do the trick hopefully. Quote Link to post Share on other sites
Walter1 8 Posted March 10, 2014 Author Report Share Posted March 10, 2014 UPDATE: Ok so i did a simple check with this code and guess what, now the requested data was pulled from the server... Not sure why but now i can continue my work. set(#TEST, $plugin function("PHPUbotAddons.dll", "Execute From Code", "$con=mysqli_connect(\"xxx.xx.xx.xxx\",\"xxx_name\",\"pass\",\"xxx_DB\"); // Check connection if (mysqli_connect_errno()) \{ echo \"Failed to connect to MySQL: \" . mysqli_connect_error(); \} $result = mysqli_query($con,\"SELECT * FROM xxxDB\"); while($row = mysqli_fetch_array($result)) \{ echo $row[\'specificrow\']; \} mysqli_close($con);", "C:\\Program Files\\PHP\\v5.4\\php.exe"), "Global")load html(#TEST) Thanks Blumi for noticing the php option duh... Quote Link to post Share on other sites
blumi40 222 Posted March 10, 2014 Report Share Posted March 10, 2014 fine ! u welcome Quote Link to post Share on other sites
Bot-Factory 602 Posted March 10, 2014 Report Share Posted March 10, 2014 UPDATE: Ok so i did a simple check with this code and guess what, now the requested data was pulled from the server... Not sure why but now i can continue my work. set(#TEST, $plugin function("PHPUbotAddons.dll", "Execute From Code", "$con=mysqli_connect(\"xxx.xx.xx.xxx\",\"xxx_name\",\"pass\",\"xxx_DB\"); // Check connection if (mysqli_connect_errno()) \{ echo \"Failed to connect to MySQL: \" . mysqli_connect_error(); \} $result = mysqli_query($con,\"SELECT * FROM xxxDB\"); while($row = mysqli_fetch_array($result)) \{ echo $row[\'specificrow\']; \} mysqli_close($con);", "C:\\Program Files\\PHP\\v5.4\\php.exe"), "Global")load html(#TEST) Thanks Blumi for noticing the php option duh... Maybe I'm wrong, but I think Blumi was talking about having a PHP script on your server which handles the database connection.And then communicate with that PHP script from your bot. If you use PHP locally, all your customers have to install PHP on their system. Or you include it in your installer if that's an option.Dan Quote Link to post Share on other sites
Walter1 8 Posted March 10, 2014 Author Report Share Posted March 10, 2014 Hi Dan, Yeah true but i understood wat Blumi was saying only it was too complicated to do since i need data once at a time from multiple rows/columns AND able to update them when needed. Its not for a bot that is going to be sold but mere for a service of mine. Just meant that Blumi mentioned PHP and for some reason i never thought of it to try to establish a connection trough php but rather was thinking more on the road of firewalls/permissions etc etc... Quote Link to post Share on other sites
blumi40 222 Posted March 10, 2014 Report Share Posted March 10, 2014 dan what i was trying to tell was that if u use hma vpn it could happend that your ubotscript not connect to your databasebecause all except http/s is blocked....i was getting this issue many times even i try german vpn servers this stupid germans :) Quote Link to post Share on other sites
Aymen 385 Posted March 10, 2014 Report Share Posted March 10, 2014 its not a smart move to pull data straight from the MYSQL database , i'd say you need to create an API interface , easier/faster way to get your data without some ennoying errors!then you can use either the browser or a http call to pull the data out , output could be either xml or JSON ! Regards Quote Link to post Share on other sites
positivity13 4 Posted October 31, 2016 Report Share Posted October 31, 2016 its not a smart move to pull data straight from the MYSQL database , i'd say you need to create an API interface , easier/faster way to get your data without some ennoying errors!then you can use either the browser or a http call to pull the data out , output could be either xml or JSON ! RegardsHi Aymen,I know this post was a while ago, but can you point me in the right direction to create an API, as currently I pull my data from varies MySql queries straight from you bot.Thanks Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.