IonicWind Software

IWBasic => Database => Topic started by: billhsln on July 07, 2023, 06:40:36 PM

Title: MySQL help
Post by: billhsln on July 07, 2023, 06:40:36 PM
I can't seem to connect to the MySQL Workbench on my PC.  I may not have it configured right, since even in the workbench when I test the connection, it does not work.  So, any help will be appreciated and if someone could test the following program and let me know if it works, I would appreciate it.

' DB_test_MySQL.iwb

DEF pdb:POINTER
DEF mysqlserver[16]="localhost", mysqldatabase[16]="sakila":ISTRING
DEF mysqluser[16]="root", mysqlpw[16]="", mysqloption[16]="3":ISTRING

OPENCONSOLE

pDB=dbConnect("MySQL ODBC 8.0 Unicode Driver","Server="+mysqlserver _
               +";Database="+mysqldatabase+";User="+mysqluser+";Password="+mysqlpw _
               +";Option="+mysqloption+";","")
IF pdb <> NULL
PRINT "Connection established"
pTables = dbListTables(pdb)
PRINT "Tables:"
IF pTables <> NULL
FOR temp = EACH pTables as STRING
PRINT #temp
PRINT "Cardinality:",dbCardinality(pdb,#temp)
PRINT "\tColumns:"
pointer pColumns = dbListColumns(pdb,#temp)
IF pColumns
pointer temp2
FOR temp2 = EACH pColumns as STRING
PRINT "\t\t",#temp2
NEXT
ListRemoveAll(pColumns,TRUE)
ENDIF
NEXT
ListRemoveAll(pTables,TRUE)
ELSE
PRINT "Unable to list tables"
ENDIF
dbDisconnect(pdb)
ELSE
PRINT "Unable to connect to database"
ENDIF

LABEL done
WAITCON
END

Thanks,
Bill
Title: Re: MySQL help
Post by: billhsln on July 08, 2023, 07:32:15 PM
I got it to work, it seems that I didn't have the MySQL setup correctly and it wasn't running.

Bill