IBM – TGMC Eclipse, DB2 and Websphere
Our team took nearly 3 weeks to start implementation, which is actually not required and I do not want other starters to waste so much time. So here is a PPT file which help starters. Work Guide for tgmc
UPDATE 1(15th Nov 2010) : Here is another pdf which might be helpful, check that too. Config_WASCE_Eclipse
UPDATE 2(19th feb 2011) : The slide number 104 in the ppt ( work guide for tgmc1 ) shows the selection of only one driver. Please make a correction that you need to select following two drivers instead of just one.
1. ‘com.ibm.db2/db2jcc/9.1/jar’
2. ‘com.ibm.db2/db2jcc_license_cu/9.1/jar’
The selection of the second driver type is missing in the ppt. You can select both the drivers simultaneously by pressing control button.
NOTE : The slide number 104 in the ppt shows the selection of driver version 8.1, but you can either choose driver version 8.1 or 9.1 . This depends on the DB2 version you are using.
I would suggest to read few articles on:
1. JDBC and types of JDBC drivers available.
2. Connection Pool
3. Recordset
This gives you a better idea and understanding when you are configuring.
I have also seen most of the team struggling for the JDBC test code. So below is the sample JDBC code which can be used for testing the JDBC :-
import java.sql.*;
public class connect {
public static void main(String[ ] args)
{
try
{
Class.forName( “com.ibm.db2.jcc.DB2Driver” );
Connection con = DriverManager.getConnection( “jdbc:db2://localhost:50000/testdb”, “db2admin”, “db2_pass” );
Statement statement = con.createStatement( );
ResultSet rs = statement.executeQuery(“select * from db2admin.db2_test_table”);
while ( rs.next( ) )
{
String firstname = rs.getString( “FIRSTNME” );
String lastname = rs.getString( “LASTNAME” );
System.out.println(“FirstName: “+firstname+”, Lastname: “+lastname);
}
statement.close( );
con.close( );
}
catch( Exception e )
{
e.printStackTrace( ); }
}
}
}
Following things to remember :-
1. In the above example in line no 8, the password has to be replaced with the one you choose. The password in the above example is “db2_pass“.
2. You need to change the table details also. The table schema used in above example is
db2_test_table(FIRSTNAME varchar(20), LASTNAME varchar(20)).
hope this helps.All the best.
NOTE : Both PPT and PDF tutorials found in this blog post are not designed by me and I too have got it from the web long ago. It is only for the purpose of sharing information with the world, so that, everyone can be benefited.
Recent Comments