• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How use URL directly with DataSource?

 
Dan Bizman
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see all the time, web servers that ask (in XML config files) for a DataSource's URL string. Then when you get that DataSource from a context, it's configured for that URL (and the properties set in it). However, I cannot find anywhere, any code that shows me how to directly pass a jdbc URL to a DataSource. I've only seen code for using JDBC url's with DriverManager.

Is this because all those webserver's also are not using the URL, but instead parse the url string and pass each parameter individually through "set" methods? Or can someone post example code here?
 
Brian Mozhdehi
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think its exactly as you state, that the code parses the URL and sets the parameters. It would be nice if the DataSource API allowed the passing of URLS, since even though many of these are vendor specific, it does seem like the vendor could provide the parsing mechanism.

In any case, I know of no way to pass a URL to a DataSource
 
Scott Selikoff
author
Saloon Keeper
Posts: 4031
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to take this back a minute and ask, what problem would you like to solve? The idea of a server data source is that server controls the object accross all instances (in most implementations). If an application had the ability to reset a data source, it could affect other applications on the server, as well as performance, pooling, and data caching. If you want an on-the-fly change of databases you might consider a set of data sources that the user can choose from, otherwise, the user should access the server via the administrator console to change data sources.
 
Dan Bizman
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Scott Selikoff:
I'd like to take this back a minute and ask, what problem would you like to solve? The idea of a server data source is that server controls the object accross all instances (in most implementations). If an application had the ability to reset a data source, it could affect other applications on the server, as well as performance, pooling, and data caching. If you want an on-the-fly change of databases you might consider a set of data sources that the user can choose from, otherwise, the user should access the server via the administrator console to change data sources.


It's just an exercise but, I'm writing an actual simple server myself. That's why I needed to know how best to create a DataSource and set it up for all the configurations in the URL.

The question I have is this: if the servers out there are parsing the URL, how do they know HOW to parse it? Each JDBC driver uses a diff. and proprietary URL/query spec. E.g. they use diff delimiters, diff. property names, etc. Where do they get the "knowledge" for parsing it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic