how to connect PB to mysql with OpenDatabase?
Posted: Sat Jul 19, 2003 10:49 am
i have a slight problem:
i just want to set up a connection from my PB-programm to a local mysql-database (mysql vers. 4.0; myODBC aktual version).
i dont want to use the OpenDatabaseRequester, because i want to open only one specific database.
my database connection parameters are:
ODBC DataSourceName = billing
host = localhost
database_name = billing
user = root
password = test
i tried this syntax: OpenDatabase(#2, billing$,root$, test$), but the result is '0' (=database not found or user/password wrong).
i can get the database from the mysql-controlcenter (=GUI for mysql-databases) without any problem using the parameters:
host = localhost
user = root
password = test
the whole code of my small programm is:
If InitDatabase() = 0
MessageRequester("Error", "Can't initialize Database (ODBC v3 or better) environment", 0)
End
EndIf
Result=OpenDatabase(#2, billing$,root$, test$)
MessageRequester("fehler1 = 0", Str(Result),#PB_MessageRequester_Ok)
query.s = "INSERT INTO billing.aktverb persID, anschlussID VALUES '123','123'"
Result=DatabaseQuery(query$)
MessageRequester("fehler2 = 0", Str(Result),#PB_MessageRequester_Ok)
CloseDatabase(#2)
it would be great, if anyone can help me!
thanks!
kimio
i just want to set up a connection from my PB-programm to a local mysql-database (mysql vers. 4.0; myODBC aktual version).
i dont want to use the OpenDatabaseRequester, because i want to open only one specific database.
my database connection parameters are:
ODBC DataSourceName = billing
host = localhost
database_name = billing
user = root
password = test
i tried this syntax: OpenDatabase(#2, billing$,root$, test$), but the result is '0' (=database not found or user/password wrong).
i can get the database from the mysql-controlcenter (=GUI for mysql-databases) without any problem using the parameters:
host = localhost
user = root
password = test
the whole code of my small programm is:
If InitDatabase() = 0
MessageRequester("Error", "Can't initialize Database (ODBC v3 or better) environment", 0)
End
EndIf
Result=OpenDatabase(#2, billing$,root$, test$)
MessageRequester("fehler1 = 0", Str(Result),#PB_MessageRequester_Ok)
query.s = "INSERT INTO billing.aktverb persID, anschlussID VALUES '123','123'"
Result=DatabaseQuery(query$)
MessageRequester("fehler2 = 0", Str(Result),#PB_MessageRequester_Ok)
CloseDatabase(#2)
it would be great, if anyone can help me!
thanks!
kimio