So I've been developing an app which goes to MYSQL and gets records etc. In Dev environment, it works fine. (Windows 11). After which when I compile it to a Console App (compiler option), the database does not connect anymore.
Am I doing something wrong? Do I need to include or install a MYSQL library or something? I thought it may be the dev environment so I installed PB on the win 2016 server I was deploying to, ran it in Dev and it was fine. Ran it as exe and same issue.
Say the following code...
Code: Select all
UseMySQLDatabase()
DBConn = OpenDatabase(#PB_Any, "host=127.0.0.1 port=28177 dbname=mydb", "root", "SNIP", #PB_Database_MySQL)
If Not DBConn
PrintN(DatabaseError())
Debug(DatabaseError())
EndIf
Debug("Hello")
If OpenConsole()
PrintN("Hello")
SqlStr.s = "select count(*) from orders"
If DatabaseQuery(DBConn, SqlStr)
While NextDatabaseRow(DBConn)
Total.l = GetDatabaseLong(DBConn, 0)
Debug("Total Records: " + Str(Total))
PrintN("Total Records: " + Str(Total))
Wend
FinishDatabaseQuery(DBConn)
CloseDatabase(DBConn)
Else
PrintN(DatabaseError())
Debug(DatabaseError())
EndIf
CloseConsole()
EndIf
Any advice?
Thanks