aspose file tools*
The moose likes JDBC and the fly likes MySQL: Is database name must in connection URL? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MySQL: Is database name must in connection URL?" Watch "MySQL: Is database name must in connection URL?" New topic
Author

MySQL: Is database name must in connection URL?

P Lavti
Ranch Hand

Joined: Mar 27, 2007
Posts: 65
Hi All,

I am using mysql with Jboss AS.

Is it required to give the the database name in connection URL?
<connection-url>jdbc:mysql://hostname:port/<I>database-name</I></connection-url>

My application is using 2 databases, to connect to both the databases, do I need to have two JNDI names declared in mysql-ds.xml?

Or is there any way to avoid having two JNDI names declaration and still I can connect to both the databases?

Thanks!


-P Lavti<br />SCJP 5.0 (88%)
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 637
why you want to avoid it?

I dont think this is possible unless you have to hardcode it in your code.

-P


All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3710
    
    5

Originally posted by P Lavti:
Or is there any way to avoid having two JNDI names declaration and still I can connect to both the databases?


No, unless you don't use mysql-ds.xml.


My Blog: Down Home Country Coding with Scott Selikoff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MySQL: Is database name must in connection URL?