Someone help me to understand how the PureBasic works with MySQL databases?
Examples of PureBasic online documentation do not work or miss something I could not identify.
How is the connection to the MySQL server?
How indicate which ODBC Driver/version I want to use?
You can join PureBasic code that works?
Advance grateful for any information
Pure Basic and MySql
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Pure Basic and MySql
Have a try here: http://purebasic.fr/english/viewtopic.php?f=5&t=48634
BERESHEIT
Re: Pure Basic and MySql
Thank you for the information.
Only now I could test and the result is not entirely positive.
I find it very strange that the native commands PB not function.
On the other hand, since it did not merit the attention of anyone else,
I must conclude that does not exist in the user community
anyone else who uses Mysql or unable to lend a hand?
Thanks again.
Only now I could test and the result is not entirely positive.
I find it very strange that the native commands PB not function.
On the other hand, since it did not merit the attention of anyone else,
I must conclude that does not exist in the user community
anyone else who uses Mysql or unable to lend a hand?
Thanks again.
Re: Pure Basic and MySql
PB works fine with MySQL. Just download ODBC drivers so you can connect to the MySQL server.I find it very strange that the native commands PB not function.
Re: Pure Basic and MySql
Thank you very much for your help.
Result = OpenDatabase (#Database, DatabaseName$, User$, Password$ [, Plugin])
In the example above, '' DatabaseName$" is not the MySql Database Name but the name assigned to the ODBC configuration and it is not clear in the help of PB.
Result = OpenDatabase (#Database, DatabaseName$, User$, Password$ [, Plugin])
In the example above, '' DatabaseName$" is not the MySql Database Name but the name assigned to the ODBC configuration and it is not clear in the help of PB.
Re: Pure Basic and MySql
For anyone else having problems, here is a quick example of how to connect to a MySQL database using PureBasic and ODBC drivers...
MySQL Server is installed on a Server at: myserver.com
On the server side I used phpMyAdmin to log in and create a new user...
name: paul
pass: xxxx
and created a database for user paul called: mydatabase
On my personal computer I downloaded the 32bit ODBC driver since I am using PureBasic 32bit
https://dev.mysql.com/downloads/connect ... /3.51.html
Since I am running 64bit Windows I could not use the default ODBC Data Source tool.
I used the 32bit version... C:\Windows\System\SysWOW64\odbcad32.exe
Under User Tab I clicked Add User and selected MySQL ODBC driver
Then I entered the following data...
name: mysql
desc: mysql
server: myserver.com port:3306
user: paul
pass: xxxx
database: mydatabase
Pressing TEST button gave me success message meaning everything has been set up correctly.
Then tested with some PB code...
MySQL Server is installed on a Server at: myserver.com
On the server side I used phpMyAdmin to log in and create a new user...
name: paul
pass: xxxx
and created a database for user paul called: mydatabase
On my personal computer I downloaded the 32bit ODBC driver since I am using PureBasic 32bit
https://dev.mysql.com/downloads/connect ... /3.51.html
Since I am running 64bit Windows I could not use the default ODBC Data Source tool.
I used the 32bit version... C:\Windows\System\SysWOW64\odbcad32.exe
Under User Tab I clicked Add User and selected MySQL ODBC driver
Then I entered the following data...
name: mysql
desc: mysql
server: myserver.com port:3306
user: paul
pass: xxxx
database: mydatabase
Pressing TEST button gave me success message meaning everything has been set up correctly.
Then tested with some PB code...
Code: Select all
UseODBCDatabase()
db=OpenDatabase(#PB_Any,"mysql","paul","xxxx")
If db
If DatabaseQuery(db,"Create table Test(id int,mydata text)")
Debug "Created new table"
If DatabaseQuery(db,"Insert into Test(id,mydata)values(1,'hello')")
Debug "Data added to table"
Else
Debug DatabaseError()
EndIf
Else
Debug DatabaseError()
EndIf
CloseDatabase(db)
EndIf
Re: Pure Basic and MySql
Thank you Paul.
I understood and I appreciate the effort shown to clarify the issue.
But I still say that the PB manual information is unclear.
I understood and I appreciate the effort shown to clarify the issue.
But I still say that the PB manual information is unclear.
Re: Pure Basic and MySql
You can use standard functions, see hereLima wrote:I find it very strange that the native commands PB not function.
{Home}.:|:.{Dialog Design0R}.:|:.{Codes}.:|:.{History Viewer Online}.:|:.{Send a Beer}



