diff --git a/mozilla/webtools/bonsai/configdata.in b/mozilla/webtools/bonsai/configdata.in index 7902d46cf75..f4b50a68e0d 100644 --- a/mozilla/webtools/bonsai/configdata.in +++ b/mozilla/webtools/bonsai/configdata.in @@ -37,7 +37,8 @@ set userdomain somedomain # User and password for access to the MySQL bonsai database # use empty string ("") for password if you want to access the database -# without using a password (not recommended) +# without using a password (not recommended). If you are using an older +# version of mysqltcl, you may also need to set the username to be "". set mysqluser nobody set mysqlpassword "" diff --git a/mozilla/webtools/bonsai/globals.tcl b/mozilla/webtools/bonsai/globals.tcl index 5cbf0fbace2..e0d132926ab 100755 --- a/mozilla/webtools/bonsai/globals.tcl +++ b/mozilla/webtools/bonsai/globals.tcl @@ -73,11 +73,16 @@ if {[info exists tcl_version] && $tcl_version >= 8.0} { proc NOTDEF {foo} { } + proc ConnectToDatabase {} { global mysqlhandle mysqluser mysqlpassword if {![info exists mysqlhandle]} { if { $mysqlpassword == "" } { - set mysqlhandle [mysqlconnect -user "$mysqluser"] + if { $mysqluser == "" } { + set mysqlhandle [mysqlconnect] + } else { + set mysqlhandle [mysqlconnect -user "$mysqluser"] + } } else { set mysqlhandle [mysqlconnect -user "$mysqluser" -password "$mysqlpassword"] }