comp • gb.mysql • connection • _new

New Connection (gb.db)

Dim hConnection As Connection
hConnection = New Connection ( [ DatabaseURL As String ] )

Creates a new connection object.

The format of optional DatabaseURL parameter is: $TYPE://[$USER[:$PASSWORD]@]$HOST[:$PORT]/$NAME where the $USER and $PORT parts are optional. If this parameter is given and valid, the Connection properties are filled with the information.

Since 3.18
the password can be specified in the URL.


' Create a MySQL connection
$hConn = New Connection("mysql://[email protected]:3306/testdb")
' Don't forget to set $hConn.Password if need be
' Create a SQLite3 connection, use $HOME/db.sqlite as database
$hConn = New Connection("sqlite3://" & User.Home &/ "db.sqlite")