By using a rigid dicarboxylate ligand, 4,5-di(4′-carboxylphenyl)benzene (H2L), two complexes formulated as SrL(DMF)(H2O)·(CH3CN) (DMF=N,N′-dimethylformamide) (1) and BaL(H2O)2 (2) were solvothermally synthesized and structurally characterized by single-crystal X-ray diffraction. Complexes 1 and 2 display two-dimensional (2D) layer structures. The two complexes exhibit different electrochemical and photoelectrochemical properties. Their thermal stabilities, cyclic voltammograms, UV–vis absorption and diffuse reflectance spectra and photoluminescence properties have been investigated. The band structures, the total density of states (TDOS) and partial density of states (PDOS) of the two complexes were calculated by CASTEP program. Complex 2 exhibits much higher photocurrent density than complex 1. The Mott–Schottky plots reveal that complexes 1 and 2 both are p-type semiconductors, which are in agreement with their band structure calculations.