Urinary tract infections are caused by bacteria getting into your urethra (the tube that connects the bladder to the external opening), and travelling to your bladder or kidneys. Cystitis can occur when an infection causes inflammation of the bladder.