April 25, 2024, 07:40:19 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


MySQL help

Started by billhsln, July 07, 2023, 06:40:36 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

billhsln

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
When all else fails, get a bigger hammer.

billhsln

I got it to work, it seems that I didn't have the MySQL setup correctly and it wasn't running.

Bill
When all else fails, get a bigger hammer.