[Gambas-user] hConnection = New Connection ( [ DatabaseURL As String ] )

Tobias Boege taboege at ...626...
Mon Aug 26 12:34:01 CEST 2013


On Mon, 26 Aug 2013, Bruce wrote:
> What syntax for "DatabaseURL As String"?
> 
> I'm trying to create a connection to an SQLite db in a different gambas
> project source directory:
> 
>         $conn = New
>         Connection("/share/projects/gambas3_proj/horse/horseBO/.connection/bometa.connection")
> 
> (and various other path strings to the connection definition).
> 
> All I get is "Malformed URL" error.
> 

>From the sources, I deduce the following format (and it works here):

$TYPE://$USER@$HOST:$PORT/$DB

where the :$PORT part is optional.

So to connect to something like

hConn = New Connection
With hConn
  .Type = "mysql"
  .Login = "root"
  .Password = "toor"
  .Host = "localhost"
  .Port = 3306
  .Name = "test"
  .Open()
End With

you could write

hConn = New Connection("mysql://root@...40...:3306/test")
hConn.Passwort = "toor"
hConn.Open()

Regards,
Tobi




More information about the User mailing list