Jump to content

MySQL UDF...help needed


Clay
 Share

Recommended Posts

I am using the following UDF with a MySQL ODCB 5.1 Driver on a Window XP 64 bit Os. I Configured my System DSN to produce a successful connection, however when I attempt to return results using the UDF I get an error...

"The requested action with this object has failed" when an attempt is made of open the connection at the following line

$ObjConn.open ("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" & $sDatabase & ";UID=" & $sUsername & ";PWD=" & $sPassword & ";PORT="&$iPort)

Func _MySQLConnect($sUsername, $sPassword, $sDatabase, $sServer, $sDriver = "{MySQL ODBC 5.1 Driver}", $iPort=3306)
    Local $v = StringMid($sDriver, 2, StringLen($sDriver) - 2)
    
    MsgBox(0, "", $v ); DEBUG
    
    MsgBox(0, "", $sDriver ); DEBUG
    
    Local $key = "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers", $val = RegRead($key, $v)
    
    MsgBox(0, "", $val ); DEBUG
    
    If @error or $val = "" Then
        SetError(2)
        Return 0
    EndIf
    $ObjConn = ObjCreate("ADODB.Connection")
    $ObjConn.open ("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" & $sDatabase & ";UID=" & $sUsername & ";PWD=" & $sPassword & ";PORT="&$iPort)
    If @error Then
        SetError(1)
        Return 0
    Else
        Return $ObjConn
    EndIf
EndFunc  ;==>_MySQLConnect

I can not even create a connection despite having the proper DSN ....

I obviously do obviously do not know why this is happening because I do have all the proper arguments passed to the fuction..... any ideas anyone

I looked through a few forums, however in most it seems that atleast connections have been made, so I know this is possible .. its just pissing me off.

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...

That's odd. I have this UDF and the 3.5 driver and it works perfectly for me. Show us what code you have so far,maybe it's an error in coding.

Link to comment
Share on other sites

I tried putting this together on my machine which is running vista 64bit and the driver had errors as well. On another system running xp 32bit the udf and driver worked perfectly. Does this have to be run on that particular machine?

Link to comment
Share on other sites

You have to ensure the driver is the correct version and type for the system. 64 bit OSes require 64 bit drivers, and 32 requires 32. Just make sure that things are in proper order.

Link to comment
Share on other sites

my problem was there is a new version of the UDF.. once i installed it no problem.. connected

I think we are using 2 different versions of the UDF.

You probably got the file from here:

http://www.autoitscript.com/forum/index.ph...14&hl=mysql

There is a little link in that first post that says:

I have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:

kan2.sytes.net/publicsvn/mysql now at revision:

I use the version from here:

http://kan2.sytes.net/publicsvn/mysql/

I believe the order of the parameters changed in that newer version.

Link to comment
Share on other sites

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...