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

Bruce bbruen at ...2308...
Thu Aug 29 08:17:27 CEST 2013


On Wed, 2013-08-28 at 13:47 +0200, Tobias Boege wrote:
> On Wed, 28 Aug 2013, Bruce wrote:
> > First off, thanks everyone for your answers - all are correct.
> > 
> > My original question was purely about the syntax of the Connection
> > constructor, specifically about the optional DatabaseURL parameter.
> > 
> > Clarification 1: According to the help there are three ways to
> > initialise a connection:
> > a) by directly setting the connection properties, (as Paul describes)
> > b) by using a predefined connection, (as Fabian describes)
> > c) by using the constructor DatabasURL parameter (as Tobi describes).
> > 
> > Regarding the latter, the help is somewhat silent as to the syntax of
> > that parameter.  Thanks to Tobi, I now see it to be:
> > 
> >         $TYPE://$USER@$HOST:$PORT/$DB
> > 
> > Clarification 2: This syntax also provides a clue that this method can
> > only work where the underlying database is a server process e.g. mysql
> > or postgresql and I don't think it can work for sqlite. 
> > 
> 
> It does work like $TYPE://$PATH because for sqlite, the Host part is a
> directory and the DB is a file relative to the directory. The parser takes
> the last part of the string (after the last /) as the DB name, the stuff
> before as Host. It seems like the $USER path is also optional... I just
> tested it:
> 
> $hConn = New Connection("sqlite3:///home/tab/Kontakte.sqlite")
> 
> > In fact, contrary to Tobi's experience, I still cannot get this to work
> > (for a postgresql database).  Here I have a server machine "bluecow"
> > that has three postgresql server processes running on it (called say
> > "prod", "dev" and "test" each using a separate port). So, if I
> > understand Tobi's answer:
> > 
> >         $conn = New Connection("postgresql://bb@...2711...:5432/horse")
> > 
> > where the database name is "horse" and the dev server is using port
> > 5432, should create a valid connection, but I still get this "Malformed
> > URL" error??? 
> 
> I just installed postgresql and the following works. I followed the Arch
> Linux wiki article for setting it up (created the DB user 'root') and the
> following does indeed work (with the 'test' database created via Database
> example of Gambas):
> 
> $hConn = New Connection("postgresql://root@...40...:5432/test")
> 
> I don't know what's wrong on your side, sorry...
> 
> Regards,
> Tobi

Well, I finally grasped at the last possible straw and made a complete
new copy of the gb source repository, compiled and installed it and now
it works just like it should.

????

The thing that is   r e a l l y  weird is that all the sources are
exactly the same.  Something strange with the make is all I can guess.

thanks for the info anyway (and also for the help update!)

Bruce





More information about the User mailing list