software:db2:using_cli
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| software:db2:using_cli [2013/03/07 13:23] – seela | software:db2:using_cli [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Using Embedded SQL ====== | ||
| - | |||
| - | **All sample programs are taken for either IBM's website or from past 3421 courses. | ||
| - | Embedded SQL is another type of application that will need packages bound | ||
| - | against a database so that it can execute its SQL. | ||
| - | Embedded applications can be written in a number of host languages. C\C++, JAVA(SQLJ), COBOL and FORTRAN** \\ | ||
| - | \\ | ||
| - | |||
| - | |||
| - | ---- | ||
| - | |||
| - | ====Table Creation for Sample Programs==== | ||
| - | |||
| - | ---- | ||
| - | Connect to the database you are using for your course | ||
| - | |||
| - | Table Sailors | ||
| - | |||
| - | create table sailors ( | ||
| - | | ||
| - | sname varchar(20), | ||
| - | rating smallint, | ||
| - | age smallint, | ||
| - | primary key (sid) | ||
| - | ); | ||
| - | |||
| - | insert into sailors ( sid, sname, | ||
| - | (22,' | ||
| - | (29,' | ||
| - | (31,' | ||
| - | (32,' | ||
| - | (58,' | ||
| - | (64,' | ||
| - | (71,' | ||
| - | (74,' | ||
| - | (85,' | ||
| - | (95,' | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ====Sample Java Program==== | ||
| - | |||
| - | {{: | ||
| - | \\ | ||
| - | \\ | ||
| - | |||
| - | This file will be downloaded as ezsailor.java | ||
| - | Rename the file to EzSailor.java | ||
| - | | ||
| - | | ||
| - | |||
| - | | ||
| - | javac EzSailor.java | ||
| - | |||
| - | | ||
| - | |||
| - | java EzSailor sample where sample is the database I used to store my tables | ||
| - | |||
| - | </ | ||
| - | |||
| - | ====Sample Perl Program==== | ||
| - | |||
| - | |||
| - | {{: | ||
| - | |||
| - | ====Sample Sqlj Program==== | ||
| - | |||
| - | {{: | ||
| - | |||
| - | |||
| - | For sqlj programs, you would need | ||
| - | * a sqlj precompiler which translates file.sqlj into java pgms. | ||
| - | * a java compiler | ||
| - | * Sqlj runtime classes (available *.zip) | ||
| - | -sqlj.runtime | ||
| - | - sqlj.runtime.ref | ||
| - | - sqlj.runtime.profile | ||
| - | - sqlj.runtime.profile.ref | ||
| - | * A jdbc driver implementing package java.sql | ||
| - | |||
| - | How to execute the sqlj? This program uses the universal type 2 driver | ||
| - | |||
| - | Steps to follow | ||
| - | |||
| - | | ||
| - | - ~db2leduc/ | ||
| - | | ||
| - | -This will strip the java code from the sql code within the sqlj program and create sub files. (Program name sqlj) | ||
| - | | ||
| - | - The SQLJ customization process binds four packages to the DB2 server. - To run execute " db2sqljcustomize -url jdbc: | ||
| - | |||
| - | | ||
| - | - java sailor 71 | ||
| - | | ||
| - | |||
| - | | ||
| - | |||
| - | |||
software/db2/using_cli.1362680607.txt.gz · Last modified: by seela
