What are the most well known / commonly accepted variable names used for the SQL connection itself?
- In Perl, I have seen
$dbh
(stands for database handle, but why 'handle'), which has been used only for this purpose: only for databases, nothing else. - In Java, I have seen things like
connection
,con
,c
; all of which could be used for non-SQL connections as well, and are therefore slightly subject to name collisions, requiring a break from the pattern.
I could use a variable name like sql
(unusual, but pretty clear), or sqlConnection
(uncomfortably long), but I wanted to see if there is any obvious standard I am missing out on?
Do most programmers besides myself have a clear idea of what dbh
means? Should I just use sql
? Do you think I really ought to spell it out as sqlConnection
?
myDatabaseConnection
. Other languages might value terseness and call it simplydb
. The important thing is to be consistent with the idioms of your particular project/company/language. – MattDavey Jan 31 at 14:51