|
Hi Tim, Yeah, what Richard said. In fact, if you look further down in the tutorial (hint), you'll see "Generalizing Connection Information", which does exactly that. That's how the programs can run against the three databases, or any other, unchanged - just point ot the new properties. > Why would I pick one over the other? Class.forName( sDriver ) loads a class given just a String; that means you can pass in the driver class. No hard coding, that's why I would pick it. A standard JDBC driver executes a static section of code on class loading that registers itself with the DriverManager. HTH, Joe Sam Joe Sam Shirah - http://www.conceptgo.com conceptGO - Consulting/Development/Outsourcing Java Filter Forum: http://www.ibm.com/developerworks/java/ Just the JDBC FAQs: http://www.jguru.com/faq/JDBC Going International? http://www.jguru.com/faq/I18N Que Java400? http://www.jguru.com/faq/Java400 ----- Original Message ----- From: "Hatzenbeler, Tim" <thatzenbeler@clinitech.net> To: "'Java Programming on and around the iSeries / AS400'" <java400-l@midrange.com> Sent: Thursday, February 13, 2003 1:23 PM Subject: RE: please critique > Thank you for the link... And after a few paragraphs, I saw something, that > is unclear to me.. > > Is it better to do 1 > 1)String sDriver = > "COM.cloudscape.core.RmiJdbcDriver"; > String sURL = > "jdbc:cloudscape:rmi:jGuru;create=true"; > String sUsername = "sa"; > String sPassword = "admin"; > > try // Attempt to load the JDBC driver > { // with newInstance > Class.forName( sDriver ).newInstance(); > } > > or a > 2) DriverManager.registerDriver(new > com.ibm.as400.access.AS400JDBCDriver()); > con = DriverManager.getConnection > ("jdbc:as400://"+system,"username","password"); > > Whats better? Class.forName or registerDriver? Or are they the same? Why > would I pick one over the other? > > Thanks again, > tim > > > -----Original Message----- > > From: Joe Sam Shirah [SMTP:jshirah@attglobal.net] > > Sent: Thursday, February 13, 2003 10:17 AM > > To: Java Programming on and around the iSeries / AS400 > > Subject: Re: please critique > > > > > > Hi Tim, > > > > The program looks basically OK from a JDBC point of view, aside > > from the clutter. Whether it's really OK depends on the needs of your > > app. Rather than running through it point by point, which most of > > > > http://developer.java.sun.com/developer/onlineTraining/Database/JDBC20Intr > > o/ > >
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.