[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gambas-bugtracker] Bug #3209: When using db2, and basing the connection for the Datasource on the connection1 it fails when password is required
[Thread Prev] | [Thread Next]
- Subject: [Gambas-bugtracker] Bug #3209: When using db2, and basing the connection for the Datasource on the connection1 it fails when password is required
- From: <bugtracker@xxxxxxxxxxxxxx>
- Date: Wed, 09 Sep 2026 20:05:11 GMT
- To: brian@xxxxxxxxxxxxxxxx,bugtracker@xxxxxxxxxxxxxxxxxxxxxx
http://gambaswiki.org/bugtracker/edit?object=BUG.3209&from=L21haW4- Comment #2 by Brian G: Ok, here I added this hack into gb.db2 open function Public Sub Open() Dim sType As String Dim hDriver As _DatabaseDriver If $pHandle Then Error.Raise("Connection already opened") ' add this hack so that I can open the connection with a user provided password when using IDE connections If Classes["ConnectSessionsInit"] Then Dim dbinit As Class = Classes["ConnectSessionsInit"] Dim sessionInit As Object = dbinit.New() If dbinit.Exist("ReadPassword") Then Object.Call(sessionInit, "ReadPassword", [Me]) Endif Endif 'end of hack sType = Trim($sType) If Not sType Then Error.Raise("Missing connection type") If sType = "sqlite" Then sType = "sqlite3" Try Component.Load("gb.db2." & LCase(sType)) If Error Then Error.Raise("Unable to load database driver: " & Error.Text) hDriver = Object.New("_DatabaseDriver_" & LCase(sType)) Object.Attach(hDriver, Me, "DatabaseDriver") _Driver = hDriver $pHandle = hDriver.Open(Me) $iLimit = 0 $iTrans = 0 End Into my app I now add the class ConnectSessionsInit class , this becomes a global class to init all opening connections, probably a better way to implement something like this though Public Sub ReadPassword(Con As Connection) If Con.name = "vmail" Then Con.password = "mypassword" ' could be any method of getting password of course Endif End until some other solution is proposed, ----[ Gambas bugtracker-list is hosted by https://www.hostsharing.net ]----
| [Gambas-bugtracker] Bug #3209: When using db2, and basing the connection for the Datasource on the connection1 it fails when password is required | <bugtracker@xxxxxxxxxxxxxx> |