Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Java DataSource example?

59 views
Skip to first unread message

Mr. K.V.B.L.

unread,
Apr 26, 2012, 4:48:03 PM4/26/12
to
Previously in my 2 or so Java programs I've used a DriverManager SQL class. So I'm trying to understand how a DataSource is configured on an iSeries machine for a Java program that will run on an iSeries. Everything I've read so far says that a DataSource is the most preferred method/most portable, etc. I'm pretty sure there are no DataSources defined on our dev or prod boxes but I don't really know that either. So, how do you look these things up, how are they initially configured then coded? Just a tiny bit in the dark here.

iseriesflorida

unread,
Apr 27, 2012, 9:24:45 AM4/27/12
to
On Apr 26, 4:48 pm, "Mr. K.V.B.L." <kenverybigl...@gmail.com> wrote:
> Previously in my 2 or so Java programs I've used a DriverManager SQL class.  So I'm trying to understand how a DataSource is configured on an iSeries machine for a Java program that will run on an iSeries.  Everything I've read so far says that a DataSource is the most preferred method/most portable, etc.  I'm pretty sure there are no DataSources defined on our dev or prod boxes but I don't really know that either.  So, how do you look these things up, how are they initially configured then coded?  Just a tiny bit in the dark here.

I believe this is what your talking about, take a look at wrkrdbdire
command.

Mr. K.V.B.L.

unread,
Apr 27, 2012, 3:00:39 PM4/27/12
to
On Friday, April 27, 2012 8:24:45 AM UTC-5, iseriesflorida wrote:
>
> I believe this is what your talking about, take a look at wrkrdbdire
> command.

Yeah, this lists the databases on the system. I don't really understand though where on the i where all of the DataSource-related stuff is.

Dieter Bender

unread,
Apr 28, 2012, 3:59:45 AM4/28/12
to
DriverManager is a class (implementation) provided by standard Java and you
could dirctly use any JDBC Driver. DataSource is an Interface (has no
implementation) in package javax.sql (have a look to:
http://docs.oracle.com/javase/1.4.2/docs/api/javax/sql/DataSource.html ) .
In the J2EE environment the Webserver (Tomcat for example) or Appserver will
provide an implementation for you and the documentation of it will tell you
how to configer it (in the web.xml config file for example). If you are
writing standalone applications, you could continue to use DriverManager, or
use a ConnectionPool (DBCP or c3p0 for instance), depemding on your needs.

D*B

"Mr. K.V.B.L." <kenvery...@gmail.com> schrieb im Newsbeitrag
news:14860285.2342.1335473283773.JavaMail.geo-discussion-forums@ynjj38...

Dr.Ugo Gagliardelli

unread,
May 2, 2012, 4:07:13 AM5/2/12
to
il 26.04.2012 22:48, Scrive Mr. K.V.B.L. 215502332:
A DataSource has nothing to do with db server configuration, it's only
defined by the client.
Look at
http://docs.oracle.com/javase/1.4.2/docs/api/javax/sql/DataSource.html
0 new messages