[Gambas-user] the database connection never errors

Benoit Minisini gambas at ...1...
Wed Dec 28 22:49:13 CET 2005


On Wednesday 28 December 2005 18:36, johnf wrote:
> On Wednesday 28 December 2005 03:07, Benoit Minisini wrote:
> > On Wednesday 28 December 2005 10:32, johnf wrote:
> > > Hi,
> > > Dim myconn as Connection
> > >   WITH myconn
> > >   .Type = TypeDataBase.Text
> > >   '  "postgresql"
> > >   .Host = host.Text
> > >
> > >   .Login = username.Text
> > >
> > >   .Password = password.Text
> > >
> > >   .Name = DataBase.Text
> > >
> > > END WITH
> > > TRY myconn.Open()
> > > IF ERROR THEN PRINT "Database cannot be opened. Error =:"; Error.Text
> > >
> > >
> > > The TRY opens even if I pass bad infomation in the text fields.  It
> > > never errors.   Am I doing something wrong?  I notice that the database
> > > demo also never errors.  Suse 10.0 Gambas 1.9.22
> > > John
> >
> > Strange... I get errors there!
> >
> > What are the values of the MyConn properties exactly? I don't need
> > Password :-)
> >
> > And did you try with the database manager?
>
> I did not try with the database manager.  Actually, I don't know how to run
> it (remember I'm a newbie). 

'Tools' -> 'Database manager' in the Development Environment menus.

> What is the name of the database manager file. 
> Checking the code in the database example I notice that you never use "TRY
> myconn.Open()".  The database project always uses "CATCH".  Is this why I
> don't get errors?

No, this has about the same effect (at least it should).

>
> Anyway I only get errors from "exec" commands from my code.
> .Type = "postgresql"
> .Host = "192.168.1.200"
> .Login = "johnf"
> .Name = "Real-Acconting"
> .Password = "password"
>
> From the Database example I get errors if I attempt to use a wrong "host",
> "login" (if the login does not exist), and "name".  So if I use a login of
> "Benoit" and "Benoit" exist but pass an incorrect "password" I do not get
> an error until I attempt to access data.

Strange. I will check...

>
> John
>

Regards,

-- 
Benoit Minisini





More information about the User mailing list