MySQL OpenDatabase Handle 0

Just starting out? Need help? Post your questions and find answers here.
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

MySQL OpenDatabase Handle 0

Post by Inner »

Code: Select all

UseMySQLDatabase()
OpenConsole()

    db_openconnection.s = "=host=192.168.0.5 port=3306 dbname=dbo"
    db_user.s = "user"
    db_password.s ="password"

    handle = OpenDatabase(#PB_Any,db_openconnection,db_user,db_password)
    
    PrintN("Handle = "+Str(handle))
        
    CloseDatabase(handle)
    
    
    Delay(1000)
    
CloseConsole()
While in the Pure Basic IDE this results in OpenDatabase returning a handle, however compile it to an executable and the handle is Null.

Is there some compiler option I've missed or some other reason why this is the case?
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1252
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Re: MySQL OpenDatabase Handle 0

Post by Paul »

The UseMySQLDatabase requires libmariadb.dll to be included with your compiled app (it's not statically linked).
Did you copy this file from the "PureBasic\Compilers\" folder into the same folder as your compiled app?
Image Image
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Re: MySQL OpenDatabase Handle 0

Post by Inner »

Paul wrote:The UseMySQLDatabase requires libmariadb.dll to be included with your compiled app (it's not statically linked).
Did you copy this file from the "PureBasic\Compilers\" folder into the same folder as your compiled app?
I didn't as I was unaware it didn't statically link at compile time. thanks for the assistance.
Post Reply