Sign in to follow this  
Followers 0
Clay

MySQL UDF...help needed

12 posts in this topic

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.

Share this post


Link to post
Share on other sites



:P .. in otther words I have the ODBC 5.1 Driver installed but I can not seem to get a connection when using the UDF

Share this post


Link to post
Share on other sites

Can you connect manually from that client, to that server, using those credentials?

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

I've exactly the same problem. I've tried to connect to server using a client like HeidiSQL and it runs correctly. Have you some hints?

Share this post


Link to post
Share on other sites

You have to have the 3.5 version as well. Did you try installing that driver and testing?

The driver version I've installe is 3.51.26.00. The driver appears on the list of ODBC driver. The OS is WinXP. I've already tried to restart the system. The same installation on another my PC runs correctly. Thanks

Share this post


Link to post
Share on other sites

i have the same problem and tested locally and on the internet same issue..

i am using 5.1 is that that problem?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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  
Followers 0