Norman:
Thanks for the tip. It brings to light another oddity. Playing
with this revised code (based on your idea), it looks like its
connecting to the database that has the same name as the username.
It's ignoring the DatabaseName completely.
Dim db as PostgreSQLDatabase
Dim rs as RecordSet
db = New PostgreSQLDatabase
db.host = fldHost.Text
db.port = Val(fldPort.Text)
' db.DatabaseName = fldDatabase.Text
db.DatabaseName = "postgres"
db.Username = fldUser.Text
db.Password = fldPassword.Text
if db.connect then
MsgBox "Congratulations! Communications with database verified."
rs = db.SQLSelect("select current_database()")
if rs.RecordCount = 1 then
msgbox "Connected to " + rs.IdxField(1).StringValue
end if
db.close
else
MsgBox "Uh oh! Something is wrong. Check the server details and
firewall settings."
end if
Notice that I hardcoded .DatabaseName to "postgres". I use my
"rbtest" username when I run this code. It tells me it connected to
"rbtest" database. I changed DatabaseName to "rbtest" and tried to
login as postgres user. It connected to the postgres database.
Something is definitely weird here.
Regards,
Robert
On Apr 30, 2008, at 10:03 AM, Norman Palardy wrote:
> dim rs as RecordSet = db.SQLSelect("select current_database()")
>
> if not rs is nil then
> msgbox "Connecte to " + rs.IdxField(1).StringValue
> end if
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|