Jump to content
Sign in to follow this  
CrewXp

MySQL Error. Can't find reason. Important, backend to my program. Augh!

Recommended Posts

CrewXp

Hey, I'm trying to incorporate mysql into my program to query my database. But I'm getting some errors. I'll lay it out in 4 parts, as I did it.

1.) SETUP

-Installed ODBC located here.

-Ran the installer located here at the MySQL UDF topic.

-Results: Worked Great. Apparently Installed.

-Used Include Files: sql.au3 found here and mysql.au3 found here

(Used sql AND mysql above to test out to see which one worked.... neither did)

2.) PLAN

I need to query www.myserver.com with username: username_testdb, password: testpassword

To the database: username_testusername

To get the results of the table 'Categories', and place them in an array.

3.) TEST

#include "sql.au3"
_SQLConnect ( 'www.myserver.com', 'username_testdb', 'username_testusername', 'testpassword' )
_SQLExecute ( 'SELECT * FROM `table` LIMIT 1' )
_SQLClose()

OR

#include "mysql.au3"

$SQLServerOBJ = _MySQLConnect("monshery_ShlomiK","Password","monshery_USDLinks","65.254.38.250")
    If $SQLServerOBJ = 0 Then
        If @error = 1 Then MsgBox(0,"Error","can't connect!")
        If @error = 2 Then MsgBox(0,"Error","missing drivers!")
    EndIf
    $ret = _GetColVals($SQLServerOBJ,"Applications","Title")
    If IsArray($ret) <> 1 Then
        If @error = 1 Then MsgBox(0,"Error","Something Went Wrong!")
    EndIf

4.) RESULTS

-Got this in SciTE with both test runs:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\Programming\SQL\simple_sql_test.au3"

C:\Program Files\AutoIt3\Include\sql.au3 (11) : ==> The requested action with this object has failed.:

$adCN.Open ("DRIVER={SQL Server};SERVER=" & $server & ";DATABASE=" & $db & ";uid=" & $username & ";pwd=" & $password & ";")

$adCN.Open ("DRIVER={SQL Server};SERVER=" & $server & ";DATABASE=" & $db & ";uid=" & $username & ";pwd=" & $password & ";")^ ERROR

>Exit code: 1 Time: 16.219

Now, I can't figure out why I'm getting that error! I'm at a serious stand-still, as my program relies on

Share this post


Link to post
Share on other sites
weaponx

I'm testing it right now with my server.

Share this post


Link to post
Share on other sites
weaponx

I get no errors. Are you sure your table and column names are correct?

#include "mysql.au3"

;username, password, db, address
$SQLOBJ = _MySQLConnect("username","password","db","192.168.1.10")

If $SQLOBJ = 0 Then
    If @error = 1 Then MsgBox(0,"","Error","Error opening connection")
    If @error = 2 Then MsgBox(0,"","MySQL ODBC Driver not installed.")
Else
    MsgBox(0,"","Connection successful")
EndIf

;mysql object, table, column
$ret = _GetColVals($SQLOBJ,"users", "user_full_name")
If IsArray($ret) <> 1 Then
    If @error = 1 Then MsgBox(0,"Error","Something Went Wrong!")
EndIf

Share this post


Link to post
Share on other sites
CrewXp

also, I dont think it's server related. It think it' some other problem, as it doesn't even get to the actual autoit code. It stops at _MySQLConnect, and gives an error there that I posted above.

Edited by CrewXp

Share this post


Link to post
Share on other sites
weaponx

I tested with your connection info and it failed. On my host I have to do this:

cpanel > MySql Databases > Access Hosts > my outside IP or outside wildcard %

Do you have your outside ip in this list?

Share this post


Link to post
Share on other sites
CrewXp

Important Question: did you get the same message as me?

And how do I add my own wildcard? I went to whatismyip.com and put in that, but idk.

And I put in %, and %.%.%.%, and of course my ip. So... it should be working.

Share this post


Link to post
Share on other sites
weaponx

The first test I did was on an internal MySQL server, after you sent me the test info I tried and got:

MYSQL UDF\mysql.au3 (27) : ==> The requested action with this object has failed.:

So now I'm trying to connect to my outside MySQL server with the Access wildcard set and I am getting the same error.

I am currently trying to setup an ODBC system DSN to my outside server.

Using the MySQL Connector in my ODBC Data Source Administrator it keeps returning SQL_ERROR

The Diagnostics button shows a log:

[MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'www.wsos.org' (10060)

[MySQL][ODBC 3.51 Driver]Unknown MySQL server host 'http://www.wsos.org' (11004)

Edited by weaponx

Share this post


Link to post
Share on other sites
weaponx

Alright, I had a friend connect successfully from a home computer so the firewall must be blocking the outbound port 3306.

Share this post


Link to post
Share on other sites
CrewXp

he connected successfully to my server?

Share this post


Link to post
Share on other sites
weaponx

No, to mine.

Share this post


Link to post
Share on other sites
CrewXp

so let me get this straight. You got the same error message as me when you first tried to connect to your server?

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\Programming\SQL\simple_sql_test.au3"
C:\Program Files\AutoIt3\Include\sql.au3 (11) : ==> The requested action with this object has failed.:
$adCN.Open ("DRIVER={SQL Server};SERVER=" & $server & ";DATABASE=" & $db & ";uid=" & $username & ";pwd=" & $password & ";")
$adCN.Open ("DRIVER={SQL Server};SERVER=" & $server & ";DATABASE=" & $db & ";uid=" & $username & ";pwd=" & $password & ";")^ ERROR
>Exit code: 1 Time: 16.219

Can you physically connect to your server now, after turning your firewall off? If you can, and if this is correct, then that means the error means I can't access my server?

I don't have a firewall though..

Share this post


Link to post
Share on other sites
weaponx

I'm behind a corporate firewall.

When I got home I was able to connect to your test server just fine so there must be some kind of port blocking on your connection.

Your server is good to go.

Your script is good to go.

Edited by weaponx

Share this post


Link to post
Share on other sites
jokke

Id say install MySQL administration tools then if you are able to connect with any of those tools you are good to go ;) i had to hassle like hell myself to get it cracking when i started using ODBC / MySQL with autoit also. And on the + side "MySQL admin tools" are quite effective to create sql commands with :)


UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.