software:db2:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
software:db2:start [2017/03/29 09:55] seelasoftware:db2:start [2017/03/29 11:23] (current) seela
Line 153: Line 153:
 to be released upon the world as such!) In the real world, you have to look up  to be released upon the world as such!) In the real world, you have to look up 
 everything yourself. So be self-reliant. Go to the documentation when you need to. everything yourself. So be self-reliant. Go to the documentation when you need to.
-  
  
 </code> </code>
 +\\
 +=====How to find the JCC Version =====
 +\\
 +**How to find out the JCC driver version being used in your application** \\
 +\\
 +<code>
 +% db2jcc -version
 +red 278 % source ~db2leduc/sqllib/db2cshrc
 +red 280 % db2jcc -version
 +IBM Data Server Driver for JDBC and SQLJ 4.22.29
 +Alternatively
 +
 + % java com.ibm.db2.jcc.DB2Jcc -version
 +IBM Data Server Driver for JDBC and SQLJ 4.22.29 \\
 +\\
 +% /cs/local/bin/java -cp /eecs/local/pkg/db2/V11/java/db2jcc.jar com.ibm.db2.jcc.DB2Jcc -version
 +   results in \\
 +IBM DB2 JDBC Universal Driver Architecture 3.72.24
 +\\
 +</code>
 +**How to display the version of the Universal Driver**
 +\\
 +<code>
 +% /cs/local/bin/java -cp /cs/local/pkg/db2/V11/java/db2jcc4.jar com.ibm.db2.jcc.DB2Jcc -version \\
 +Returns \\
 +IBM Data Server Driver for JDBC and SQLJ 4.22.29
 +\\
 +</code>
 +====Technote====
 +\\
 +Question
 +
 +Which JDBC driver (JCC) version corresponds with each DB2 release and Fix Pack level?
 +Answer
 +
 +The IBM Data Server Driver for JDBC and SQLJ package includes two JDBC drivers:
 +
 +    db2jcc.jar - This driver is based on the JDBC 3 specification
 +    db2jcc4.jar - This driver is based on the JDBC 4 or later specifications
 +
 +The db2jcc.jar driver is now deprecated. After version 3.72, which is delivered with DB2 Version 11.1 for Linux, UNIX, and Windows Modification Pack 1 Fix Pack 1, db2jcc.jar will include no new features
 +
 +
 +=====JDBC and SQL Drivers =====
 +\\
 +**JDBC Drivers**
 +\\
 +
 +For the **DB2 JDBC Type 4 Driver**, specify a URL of the following form: 
 + TYPE 4:**(Class.forName("com.ibm.db2.jcc.DB2Driver");**
 +Connecting to a data source using the DriverManager interface with the IBM Data Server Driver for JDBC and SQLJ
 +
 +A JDBC application can establish a connection to a data source using the JDBC DriverManager interface, which is part of the java.sql package.
 +<code>
 +The steps for establishing a connection are:
 +
 +    Load the JDBC driver by invoking the Class.forName method.
 +If you are using JDBC 4.0 or later, you do not need to explicitly load the JDBC driver.
 +For IBM Data Server Driver for JDBC and SQLJ, you load the driver by invoking the Class.forName method with the following argument:
 +
 +com.ibm.db2.jcc.DB2Driver
 +
 +The following code demonstrates loading the IBM Data Server Driver for JDBC and SQLJ:
 +
 +try {
 +  // Load the IBM Data Server Driver for JDBC and SQLJ with DriverManager
 +  Class.forName("com.ibm.db2.jcc.DB2Driver");
 +} catch (ClassNotFoundException e) {
 +     e.printStackTrace();
 +}
 +
 +
 +</code>
 +
 +====A Sample JDBC Program with type 4 connectivity====
 +\\
 + {{:private:software:db2:ezsailor.java|JDBC sample program }}
 +
 +\\
 +Once downloaded , rename the file to EzSailor.java
 +\\
 +Edit the java source file to modify the database and tables you have created
 +\\
 +{{:private:software:db2:ezjava.java|Another  sample table}}
 +\\
 +Must be renamed to EzJava.java and edited to make the right connection
 +\\
 +**How to execute the jdbc program**
 +\\
 +Make sure you have the table "sailor" created or else the query will not
 +be able to execute
 +
 +  * source the client configuration file : ~db2leduc/sqllib/db2cshrc
 +  * javac EzSailor.java
 +  * java  EzJava c3421m
 +----
 +\\
 +
 +====A Sample Sqlj Program with type 4 connectivity====
 +**How to execute the sqlj code**
 +\\
 +  * Download the sample code
 +  * Table "sailor" should exist" or modify your code to use your own tables
 +{{:private:software:db2:sailors.sqlj|sqlj}}
 +\\
 +This is a sample sqlj program that does the precompiling for you .
 +Remember these are just example scripts to aid the development of your own code
 +\\
 +\\
 +   * Program name : sailor.sqlj
 +   * source ~db2leduc/.cshrc
 +   * sqlj sailors.sqlj
 +   * db2sqljcustomize -url jdbc:db2:c3421m sailors_SJProfile0.ser
 +   * java sailors 71
 +     will return your output
 +
 +
 \\ \\
  
software/db2/start.1490795715.txt.gz · Last modified: 2017/03/29 09:55 by seela