On 02/02/2017 03:23 AM, Suliman wrote:
mydb.lockConnection() does create a new connection if it needs to. And
that WILL throw an exception if there's a problem connecting to the DB
server. So your code above WILL catch an exception if the connection
information (server address/port/login/etc) is wrong.


But it does not. I am getting Access Violation instead of the exception
if connection credentials is wrong:

Authentication failure: Access denied for user 'root'@'111.111.111.111'
(using password: YES)

object.Error@(0): Access Violation
----------------
0x004436C0 in void database.Database.connect() at
D:\code\CMS\source\database.d(34)
0x00403130 in _Dmain at D:\code\CMS\source\app.d(17)
0x00593C6F in D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv
0x00593C33 in void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).runAll()
0x00593B34 in _d_run_main
0x004433CC in main at D:\code\CMS\source\app.d(7)
0x005F0929 in mainCRTStartup
0x769262C4 in BaseThreadInitThunk
0x774D0FD9 in RtlSubscribeWnfStateChangeNotification
0x774D0FA4 in RtlSubscribeWnfStateChangeNotification
Program exited with code 1


I'm unable to reproduce this problem. Are you trying to use the connection after it fails to connect? It looks like that's what's happening, you're using a null reference.

Reply via email to