views:

145

answers:

1

I am developing a hibernate application that connects to a MySQL database.

The customers would like to only specify a connection string, ie:

jdbc:mysql://username:passwd@server:port/db_name

However, Hibernate will not connect using just this string. It also wants the username and password connection properties set. Is there any way around this?

Thanks

+2  A: 

Hibernate itself does not "want username and password connection properties set"; it just passes them to your JDBC driver. Depending on what database connection pool you're using user / password may be specified via different methods.

MySQL JDBC driver allows you to specify username / password in the URL, but not in the format you've shown in your question. They should be specified as parameters instead:

jdbc:mysql://server:port/db_name?user=username&password=passwd
ChssPly76
xeon