Sorry if this isn't strictly a GIS question. I want to know if there's a public database of US streets and US States that I can simply connect to (e.g. JDBC) and run SQL queries. For example, I want to find all the streets named "California" in the state of California. I've read about Gisgraphy and OpenStreetMaps and Geonames, but I don't see how to do the kind of query I'm talking about.
I very much doubt there is any such thing - SQL database servers aren't really suitable for this kind of public-facing surface. For example, Denial of Service attacks are usually pretty trivial to construct if you allow arbitrary SQL.
There are other APIs (e.g. the overpass API and nominatim) for OpenStreetMap, but not SQL.
If by public database you mean public server, I agree with BradHards. You still can donwload the USA .osm file and use it for free (it is a "collaborative effort", which makes it quite public). Then you extract the data to a postgis/postgresql database and you can send as many requests as you want!
Pay attention to the fact that osm2psql (or the equivalent you will use) may have particular options for geocoding...