IceChat Forums

IceChat 7 => IceChat 7 Scripts => Topic started by: trollberry on April 28, 2007, 05:17:45 PM

Title: Connecting to MySQL with v7
Post by: trollberry on April 28, 2007, 05:17:45 PM
For those who wish to connect to a MySQL database from IceChat here's how (using VB).

1. Download the MySQL ODBC Driver ( from MySQL.
(and install it :P )

2. Set up a new ODBC database under Administrative Tools (Control Panel -> Administrative Tools).  Here you choose the MySQL driver and enter a name for the database, the user name that you set up to access the database etc.

3. Now for the IceChat bit:
Create a new test sub -
Code: [Select]
sub TestDatabase()
    set myconn = createobject("adodb.connection")
    connection = "driver={MySQL ODBC 3.51 Driver};server=localhost;user=[myuser];database=[mydatabase];" (connection)
    set result = createobject("adodb.recordset")
    sql = "SELECT * FROM [mytable]"
    set result = myconn.execute(sql)
    if not result.EOF then
        sendcommand "/msg $active " & result(["a field name in table"])
    end if
end sub