Author Topic: Module MySQL Overview  (Read 34024 times)

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Module MySQL Overview
« on: May 14, 2006, 10:58:34 PM »

Script_test

  • Guest
Re: Module MySQL Overview
« Reply #1 on: July 06, 2017, 07:03:05 AM »
 
Code: [Select]
mysql::RealConnect(host,user,password,database [,port])

Does it work on non-local connections?
I am trying on different external mysql servers and only receive error.
Code: [Select]
(0): error 0x00080002:Extension specific error: %s
Ty

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: Module MySQL Overview
« Reply #2 on: July 06, 2017, 11:08:16 AM »
Many MySQL servers don't allow external connections due to abuse and resource utilization trying to access it by brute force.

I would try accessing the server with Excel / ODBC just to make sure you have access rights, If all is good there, we can dig a little deeper why the SB extension module is returning an extension error.

Script_test

  • Guest
Re: Module MySQL Overview
« Reply #3 on: July 07, 2017, 12:49:56 AM »
I can connect without problems with the command > mysql -u
To test, I have created a database in a free hosting.
Code: [Select]
include mysql.bas
dbh =  mysql::RealConnect("sql8.freemysqlhosting.net","sql8183953","N9yUkvribn","sql8183953","3306")
PRINT "Host info is: ",mysql::GetHostInfo(dbh),"\n"

Code: [Select]
mysql -u sql8183953 -h sql8.freemysqlhosting.net -p


Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: Module MySQL Overview
« Reply #4 on: July 07, 2017, 10:34:20 AM »
I'm not sure but sending the port number as a string may be causing a problem.

My guess is at this point you're getting a CR_CONN_HOST_ERROR  response error message.

Update

My guess was correct and not passing the port number as a string allowed me to connect to your remote MySQL server with the Script BASIC extension module.

Code: Script BASIC
  1. include mysql.bas
  2. dbh =  mysql::RealConnect("sql8.freemysqlhosting.net","sql8183953","N9yUkvribn","sql8183953",3306)
  3. PRINT "Host info is: ",mysql::GetHostInfo(dbh),"\n"
  4.  


jrs@jrs-laptop:~/sb/examples/test$ scriba mysql_remote.sb
Host info is: sql8.freemysqlhosting.net via TCP/IP
jrs@jrs-laptop:~/sb/examples/test$


Here is an example of querying the MySQL information_schema tables.

Code: Script BASIC
  1. IMPORT mysql.bas
  2. dbh =  mysql::RealConnect("sql8.freemysqlhosting.net","sql8183953","N9yUkvribn","sql8183953",3306)
  3. mysql::query(dbh,"SELECT * FROM INFORMATION_SCHEMA.TABLES")
  4. WHILE mysql::FetchHash(dbh,tbls)
  5.   FOR x = 0 TO UBOUND(tbls) STEP 2
  6.     PRINT tbls[x]," - ",tbls[x+1],"\n"
  7.   NEXT
  8.   PRINTNL
  9. WEND
  10. mysql::Close(dbh)
  11.  
« Last Edit: July 08, 2017, 09:53:44 PM by support »

Script_test

  • Guest
Re: Module MySQL Overview
« Reply #5 on: July 24, 2017, 06:08:12 AM »
Thanks, you've been a great help.