Sure. TCP/IP can be used for anything, including connecting to databases. For instance, you might be interested in the MySQL wire protocol.
Of course, your database server must be properly secured. You should be especially careful if it is accessible from the outside Internet.
See this article for how to secure MySQL. Similar (but distinct) advice applies to other database systems.