This paper discussed fabrication of TiO2 and BaTiO3 nanotubes by sol-gel method and used anodic aluminum oxide (AAO) as template. The mechanical properties of TiO2 or BaTiO3 NTs are not great, so a longer tube can crack easily, leading to the peeling off of the NTs film from the Ti substrate. Therefore, we propose to use AAO as a template, followed by deposition of TiO2 and BaTiO3 NT inside AAO to make a working electrode for further electronic devices.