Both URLs are incorrect - should be
jdbc:mysql://host:port/database
I thought it went without saying, but connecting to a database with Java requires a JDBC driver. You'll need the MySQL JDBC driver.
Maybe you can connect using a socket over TCP/IP. Check out the MySQL docs.
See http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html
UPDATE:
I tried to telnet into MySQL (telnet ip 3306
), but it doesn't work:
http://lists.mysql.com/win32/253
I think this is what you had in mind.