1 introduction to java development with ids jean georges perrin iiug greenivory.com jgp.net tuesday,...
TRANSCRIPT
![Page 1: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/1.jpg)
1
Introduction to Java Development with IDSJean Georges PerrinIIUGGreenIvory.comJGP.netTuesday, October 3rd 2006 • 09:00 – 10:00.
Platform: IDS, Java
![Page 2: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/2.jpg)
2
Agenda
Who am I? Architecture Requirements Your very first cup of Java JDBC Your first application using the Command
Prompt Your first application using Eclipse Your first application using a framework
![Page 3: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/3.jpg)
3
Agenda
Who am I? Architecture Requirements Your very first cup of Java JDBC Your first application using the Command
Prompt Your first application using Eclipse Your first application using a framework
![Page 4: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/4.jpg)
4
Who am I?
My Unix box usually answers…
![Page 5: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/5.jpg)
5
Who am I (outside of a Unix box)? Jean Georges Perrin Development tools (xGL, Java EE, PHP) Works with Informix products since ’97 IIUG board member
since ’02 Lives in
Strasbourg, France
![Page 6: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/6.jpg)
6
A little more…
Application developer, started with Visual Basic, in the early 90s
In the web since 1994 Move to 4GL in 1997 Goals:
Webizing all things I touched (business apps, catalogs and i-4GL…)
Find the ease of use of Visual Basic
![Page 7: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/7.jpg)
7
And you…
Who knows 4GL? Who knows Java? Who thinks Java is difficult? Who knows .net?
![Page 8: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/8.jpg)
8
Agenda
Who am I? Architecture Requirements Your very first cup of Java JDBC Your first application using the Command
Prompt Your first application using Eclipse Your first application using a framework
![Page 9: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/9.jpg)
9
Architecture
DataApplication JDBC Driver
![Page 10: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/10.jpg)
10
Agenda
Who am I? Architecture Requirements Your very first cup of Java JDBC Your first application using the Command
Prompt Your first application using Eclipse Your first application using a framework
![Page 11: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/11.jpg)
11
Requirements
#1 - IDS (from v7.x, but also works on OnLine and SE) Where: www.iiug.org,
www.informix.com #2 - Java (Java SDK v5.x)
Where: www.javasoft.com #3 - JDBC driver (IBM Informix JDBC 3.0)
Where: www.informix.com #4 - Option: Eclipse (v3.2.1)
Where: www.eclipse.org
![Page 12: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/12.jpg)
12
Agenda
Who am I? Architecture Requirements Your very first cup of Java JDBC Your first application using the Command
Prompt Your first application using Eclipse Your first application using a framework
![Page 13: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/13.jpg)
13
Your very first cup of Java
Hello, world… in Java Use of “javac” Use of “java”
Code snippet:
package org.iiug.test;
public class HelloWorld {
public static void main(String[] args) { System.out.println("Hello, world..."); }}
Source code is self organizing in packages
Modules are organized in classes
main {…} is MAIN … END MAIN
“Hello, world…” is always the same, in any language…
fglpc
fglgo
![Page 14: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/14.jpg)
14
Java Pros & Cons
Object Oriented (OO) development Event driven programming model User Interface (UI) & Business Logic (BL)
tightly linked Open architecture, open standards General purpose development language Industry standard Looks like “hype” to developers
![Page 15: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/15.jpg)
15
4GL Pros & Cons
Procedural development “Controlled” events UI and BL somehow separated (.per
& .4gl) Proprietary solution Business apps development language Not a standard in industry Hard to attract new developers
![Page 16: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/16.jpg)
16
Agenda
Who am I? Architecture Requirements Your very first cup of Java JDBC Your first application using the Command
Prompt Your first application using Eclipse Your first application using a framework
![Page 17: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/17.jpg)
17
JDBC
Types of driver (annoying theory) Standard way of talking to a database
(forget about SQL/J) Use a URL, for IBM Informix:
jdbc:informix-sqli://popeye:1526/stores_demo:informixserver=ol_popeye;user=informix;password=informix
![Page 18: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/18.jpg)
18
Agenda
Who am I? Architecture Requirements Your very first cup of Java JDBC Your first application using the
Command Prompt Your first application using Eclipse Your first application using a framework
![Page 19: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/19.jpg)
19
Your first application using the Command Prompt Understand the role of the “CLASSPATH” Full source code (copy / paste):
import java.sql.*;
public class MyFirstJDBCConnection {
public static void main(String[] args) { // Define my local variables Connection myConnection; Statement myStatement; ResultSet myResultSet; // Loading driver try { System.out.println(">> Loading the driver"); Class.forName("com.informix.jdbc.IfxDriver"); } // end try catch (ClassNotFoundException e) { System.out.println("ERROR: Failed to load IBM Informix JDBC driver."); return; } // end catch
![Page 20: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/20.jpg)
20
Your first application (2)
try { // Connection to database System.out.println(">> Connecting to the database"); myConnection = DriverManager.getConnection ("jdbc:informix-sqli://popeye:1526/stores_demo: informixserver=ol_popeye;user=informix;password=informix", "", ""); // Statement creation System.out.println(">> Creating the statement"); myStatement = myConnection.createStatement(); // Resultset creation & execution System.out.println(">> Executing the query"); myResultSet = myStatement.executeQuery ("SELECT fname, lname, customer_num FROM customer ORDER BY lname"); // Outputting the result System.out.println(">> Step 4 - Dumping data"); while (myResultSet.next()) { System.out.println ( myResultSet.getString("fname") + myResultSet.getString("lname") + " (" + myResultSet.getString("customer_num") + ")"); }
![Page 21: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/21.jpg)
21
Your first application (3)
// Cleaning System.out.println(">> Cleaning"); myResultSet.close(); myStatement.close(); myConnection.close(); } // end try catch (SQLException e) { System.out.println("ERROR: SQL exception: " + e.getMessage()); e.printStackTrace(); return; } // end catch } // end main} // end class
![Page 22: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/22.jpg)
22
Declaring objects to use
Code snippet:
The “Connection” is the real connection to the database, it is (re)created each time. Except when using “connection
pooling”. The “Statement” is the real orders or
queries to the database. The “ResultSet” contains a link to the
data.
// Define my local variables Connection myConnection; Statement myStatement; ResultSet myResultSet;
Connection = DATABASE
Statement = STATEMENT
ResultSet = ARRAY OF RECORD / CURSOR
![Page 23: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/23.jpg)
23
Loading the driver
Code snippet:
Drivers are uniquely named, for IBM Informix:
// Loading driver try { System.out.println(">> Loading the driver"); Class.forName("com.informix.jdbc.IfxDriver"); } // end try catch (ClassNotFoundException e) { System.out.println("ERROR: Failed to load IBM Informix JDBC driver."); return; } // end catch
com.informix.jdbc.IfxDriver
![Page 24: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/24.jpg)
24
Connecting to the database
Code snippet: // Connection to database System.out.println(">> Connecting to the database"); myConnection = DriverManager.getConnection ("jdbc:informix-sqli://popeye:1526/stores_demo: informixserver=ol_popeye;user=informix;password=informix", "", "");
![Page 25: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/25.jpg)
25
Statement & Execution
Code snippet: // Statement creation System.out.println(">> Creating the statement"); myStatement = myConnection.createStatement(); // Resultset creation & execution System.out.println(">> Executing the query"); myResultSet = myStatement.executeQuery ("SELECT fname, lname, customer_num FROM customer ORDER BY lname");
![Page 26: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/26.jpg)
26
Looping around
Code snippet: // Outputting the result System.out.println(">> Step 4 - Dumping data"); while (myResultSet.next()) { System.out.println ( myResultSet.getString("fname") + myResultSet.getString("lname") + " (" + myResultSet.getString("customer_num") + ")"); }
![Page 27: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/27.jpg)
27
Cleaning
Code snippet:
Not only cleaning Exception Handling!
// Cleaning System.out.println(">> Cleaning"); myResultSet.close(); myStatement.close(); myConnection.close(); } // end try catch (SQLException e) { System.out.println("ERROR: SQL exception: " + e.getMessage()); e.printStackTrace(); return; } // end catch } // end main} // end class
![Page 28: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/28.jpg)
28
Agenda
Who am I? Architecture Requirements Your very first cup of Java JDBC Your first application using the Command
Prompt Your first application using Eclipse Your first application using a framework
![Page 29: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/29.jpg)
29
Your first application using Eclipse Create a project Add the library Create the class Run it
![Page 30: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/30.jpg)
30
Agenda
Who am I? Architecture Requirements Your very first cup of Java JDBC Your first application using the Command
Prompt Your first application using Eclipse Your first application using a
framework
![Page 31: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/31.jpg)
31
Your first application using a framework Goals of a framework
Ease of use Small learning curve
Database connectivity
Business logic
![Page 32: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/32.jpg)
32
BlueGazelle
Open Source framework Soon to be downloadable from
http://www.greenivory.com
![Page 33: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/33.jpg)
33
BlueGazelle Source Code
Code snippet:Database myDatabase = null;Record myRecord = null;Record myRow = null;int count = 0;int i = 0;
try { myDatabase = Databases.connect("stores_demo"); myRecord = myDatabase.createRecordFromSelect("SELECT fname, lname, customer_num FROM customer ORDER BY lname"); count = myRecord.getCount(); for (i = 0; i < count; i++) { myRow = myRecord.getRecordAt(i); System.out.println(myRow.getString("fname") + myRow.getString("lname") + " (" + myRow.getString("customer_num") + ")"); } } catch (Exception e) { System.out.println("ERROR: Exception raised: " + e.getMessage()); e.printStackTrace();} // end catch
![Page 34: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/34.jpg)
34
Conclusion
Java offers a standard way of accessing data.
Java is working in a distributed environment.
Frameworks simplify the developers’ life.
![Page 35: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/35.jpg)
35
Complexity & Features
Level of complexity / feature of languages over time
2000 20051994
Easy
Difficult
4GL
2001 2002 2003 2004 200619991998199719961995
PHPOO in PHP 4
Zend Framework?
PHP 5
J2EE
Java SE 5Eclipse
Java
Java EE 5
![Page 36: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/36.jpg)
36
And now…
Come to see me in San Jose (May 2007) Full Java Educational Seminar (you
need to stand me for 3 hours) “Introduction to EJB3 dev. with IDS
and Viper” I think I have a session or two on XML (Give me good marks so I can be
selected as best speaker of the conference and beat Darryl, Lester and Art - previous speakers and enter Hall of Fame).
![Page 37: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/37.jpg)
37
And now (seriously)…
Download Eclipse (I guess you all have IDS already)
Get a book (O’Reilly has quite a few great books)
Join the development-tools forum on IIUG web site
Get started with a few examples Come back to me
![Page 38: 1 Introduction to Java Development with IDS Jean Georges Perrin IIUG GreenIvory.com JGP.net Tuesday, October 3 rd 2006 09:00 – 10:00. Platform: IDS, Java](https://reader036.vdocuments.site/reader036/viewer/2022062717/56649e1a5503460f94b0830d/html5/thumbnails/38.jpg)
38
Introduction to Java Development with IDS
Thanks for your patienceCome back to me…
[email protected]@jgp.net