This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Using DriverManager.getConnection() to configure a DataSource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Using DriverManager.getConnection() to configure a DataSource" Watch "Using DriverManager.getConnection() to configure a DataSource" New topic
Author

Using DriverManager.getConnection() to configure a DataSource

Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2833
    
  11

I'm working with a really, really old DBMS, which nevertheless does have a JDBC driver. We are able to configure a JEE DataSource within JBoss to talk to this database, but now we need to enable SSL across this connection. The problem is that the documentation describing how to do this are for the moldy old DriverManager.getConnection() method of getting a connection. Basically, you set up a bunch a properties, then pass them in to the method, like this:



I'm trying to figure out how to translate those instructions into configuring a datasource, but getting very little help from the DB vendor's technical support. I'm thinking that maybe I could set up my own connection pool, using the DriverManager to fill it up with connection, and then point my datasource at that connection pool. Does that sound like a reasonable approach? More crucially, is there a tutorial somewhere that might show how to pull something like that off?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

I don't know how JBoss does it, but in Tomcat the resources use the same URLs as required for DriverManager. An example:
Or do you need to supply a Properties object to DriverManager to get the connection?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2833
    
  11

Yes, there are some properties involved. Things like the cipher being used, the location and password for the trust store file, the security level (I'm not clear what this one does). I feel like it might be possible to translate the instructions I have for the DriverManager into configuring a data source, but I'm slightly too stupid to work it out, and their tech support is even stupider than I am. It's extremely frustrating.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9924
    
158

Which version of JBoss AS are you using?

[My Blog] [JavaRanch Journal]
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2833
    
  11

JBoss 7.
 
 
subject: Using DriverManager.getConnection() to configure a DataSource
 
Similar Threads
DataAccess using Spring...
BMP, Jboss, and mysql configuring
Accessing Tomcat DB Pool
database connection in init() of servlet
closing pooled connection with WS naming service(jndi)