|
1) The description of what to change looks perfect although you could consider this: Class.forName("com.ibm.db2.jdbc.app.DB2Driver"); instead of this: DriverManager.registerDriver(new com.ibm.db2.jdbc.app.DB2Driver()); The advantage? The JDBC driver will register itself by creating a copy of itself in its own static initializer and calling the registerDriver function automatically. The second way will cause two DB2Driver objects to get created. The first one when the static initializer runs (which also does the register - you can't stop that) and then one is created for the statement above. Then registerDriver is called a second time but because the driver is already registered nothing happens. The other advantage to the second way is that you just have a string difference for different JDBC drivers so it is easier to pick up the right value from a properties file and use it. (Ok, that is really just opinion). Both will work (with the Native JDBC driver or any other driver that is built the way they are supposed to be). 2) The bit about QTMHHTTP does apply only to the toolbox rec level i/o. Regards, Richard D. Dettinger AS/400 Java Data Access Team "TRUE! nervous, very, very dreadfully nervous I had been and am; but why WILL you say that I am mad? The disease had sharpened my senses, not destroyed, not dulled them. " - Edgar Allan Poe "The Tell-Tale Heart" "Alex Garrison" <agarrison@logtech.com> on 01/21/2000 02:42:28 PM Please respond to JAVA400-L@midrange.com To: JAVA400-L@midrange.com cc: Subject: Re: JDBC vs ODBC Performance Richard, 1. From code you sent, you are using the toolbox jdbc driver. If you want to use the native db2 jdbc driver try: DriverManager.registerDriver(new com.ibm.db2.jdbc.app.DB2Driver()); connection = DriverManager.getConnection ("jdbc:db2:my400","myuserid","mypassword"); Make sure your class has import com.ibm.db2.jdbc.app.* instead of import com.ibm.as400.access.* 2. As far as I know the bit about QTMHHTTP applies only to the toolbox rec level i/o. Alex Garrison ----- Original Message ----- From: Richard Dean <rddean@gdi.net> To: <JAVA400-L@midrange.com> Sent: Friday, January 21, 2000 2:24 PM Subject: JDBC vs ODBC Performance > Back in early November of last year Alex Garrison brought up the issue of > "forcing native access with websphere and toolbox". And there were a bunch > of responses about getting the most optimized connection through JDBC vs > ODBC. Two things came up. > > 1. One message said that you can configure your servlet to use the native > DB2 JDBC drivers instead of the toolbox drivers for faster access. So how > do you do this? I will show how I am doing it below. > 2. The other thing is Alex mentioned something about connecting with user id > QTMHHTTP to insure the bypass of TCP/IP on the 400. Does this only apply to > record level access? Or can I do this with JDBC/ODBC to get the same > improvements? > > Here is how I am doing it: > > // Load the AS/400 Toolbox for Java JDBC driver. > DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver()); > > // Get a connection to the database. > connection = DriverManager.getConnection ("jdbc:as400://my400", > "MY_USER_ID", "MY_PASSWORD"); > DatabaseMetaData dmd = connection.getMetaData (); > > Is there a better way? > > > > Thanks in advance. > > Richard Dean > > > +--- > | This is the JAVA/400 Mailing List! > | To submit a new message, send your mail to JAVA400-L@midrange.com. > | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. > | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. > | Questions should be directed to the list owner: joe@zappie.net > +--- > +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +--- +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +---
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.