MySQLDBLib is a project to create a COM Database library to access MySQL databases. Currently only the Connection object is working. This object will allow you to execute queries and navigate the result sets. Only forward navigation is enabled, but caching the results on the client may overcome this restriction. There is an example application in Visual Basic which creates a client side recordset and caches the results.
The library implements dual interfaces, so you can instance it by using the
Server.CreateObject("MySQLDB.Connection") function.
I have tested it in Visual Basic, but not on IIS. If someone is willing to do it and give me feedback, it will be very helpful.
I have included a installation file in the package, but if it doesn't work, run the regCom.bat file in the VB application directory that comes with the install.. It will register the Atl.dll and MySQLDB.dll required to use the library. The Install program puts the Atl.dll,MySQLDB.dll and libmysql.dll in the windows system directory. If you want you can move MySQLDB.dll, MySQLDB.lib, libmysql.dll to another directory but not the ATL.dll. Also make sure you make the appropriate changes to the regCOM.bat file before you run it.
Ex:
If you move the atl.dll, MySQLDB.dll to c:\App then change the following line from regCom.atl
\windows\system\regsvr32.exe \windows\system\Atl.dll
\windows\system\regsvr32.exe
\windows\system\MySQLDB.dll
to
\windows\system\regsvr32.exe \windows\system\Atl.dll
\windows\system\regsvr32.exe C:\App\MySQLDB.dll
Then run regCom.bat. That should register all the components.
Name | Function Type | Description | Usage |
Host | Property (String) |
Sets the host on which mysql server is running. |
Connection.Host = "mysql.db.com" or Connection.Host = "123.34.232" |
Username | Property (String) | sets the username for the connection. | Connection.Username = "User1" |
Password | Property (String) | sets the password for the connection. | Connection.Password = "pwd1" |
Database | Property (String) |
sets the database to be opened. | Connection.Database ="testdb" |
Port | Property (Short) | sets the port to connect to. | Connection.Port = 2323 |
Connect | Method |
opens a connection to the mysql server. | |
Open | Method |
Opens a database specified by the Database property. Call Open after first connecting to the server by calling connect. You can change a database by changing the database property and then calling Open. | Connection.Open |
ExecuteInt(sqlString as String) | Method | Executes the sqlString passed to it. | Connection.ExecuteInt("Select * from host") |
Execute | Method | Not working as of yet. Returns a recordset | NA |
FieldCount | Property(Short) | Returns the number of fields in the result set | i = Connection.FieldCount |
RowCount | Property(Short) | Returns the number of rows in the result set | i = Connection.RowCount |
BOF | Property (Bool) | Start of the result set | bofVal = Connection.BOF |
EOF | Property (Bool) | End of the result set | eofVal = Connection.EOF |
NextRow | Method |
Moves the Cursor to the next row in the result set | Connection.NextRow |
GetItem(i) | Method | returns the i'th item from the current row as a string. |
Dim abc as String sbc = Connection.GetItem(2) |
FieldProperty(i,"Property Type") | Method |
Returns the property value of the i'th field in the result set. The property types can be "fieldLength", "fieldType" and "fieldName" . |
Dim abc as String abc = Connection.FieldProperty(1,fieldName) |
Close | Method | Closes the connection to the server |
Connection.Close |