SlideShare a Scribd company logo
1 of 41
Konsep Baru Pemodelan Database dengan Anchor Modeling Bowo Prasetyo Contoh Kasus Lanjutan Perubahan Struktur dan Konten Database 10 Desember 2011 http://www.scribd.com/prazjp   http://www.slideshare.net/bowoprasetyo
Anchor Modeling ,[object Object]
Berbasis pada empat konstruksi permodelan:  anchor ,  attribute ,  tie  dan  knot .
Hasilnya dapat diterjemahkan ke desain relational database, di mana hampir semua tabelnya akan berada pada bentuk  sixth normal form  (6NF).
Online Resources ,[object Object],http://www.anchormodeling.com/   ,[object Object],http://www.anchormodeling.com/?page_id=186   ,[object Object],http://www.anchormodeling.com/modeler/
Perubahan Database 3 Perubahan Struktur dan Konten Mencatat Lokasi
Peringatan ,[object Object]
Mencatat Lokasi ,[object Object]
Penambahan Entitas ,[object Object]
Berarti tambah  anchor  baru yang sesuai, dengan satu  attribute  untuk IP address.
Dan  tie  baru yang menghubungkannya dengan  anchor   US_User  dan  anchor   GE_Greeting . ,[object Object]
Greeting was said at location . ,[object Object]
Anchor Model ,[object Object]
Tambahan satu  attribute :   LO_IPA_Location_IpAddress
Tambahan dua  tie :   GE_wasSaid_LO_at  (bersejarah),  US_was_LO_at
Entity Relationship Model ,[object Object]
LO_Location ,
LO_IPA_Location_IpAddress,
GE_wasSaid_LO_at  dan
US_was_LO_at.
Table Creation SQL CREATE TABLE lo_location ( LO_ID int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (LO_ID) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; CREATE TABLE lo_ipa_location_ipaddress ( LO_ID int(11) NOT NULL, LO_IPA_Location_IpAddress varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (LO_ID), UNIQUE KEY LO_IPA_Location_IpAddress (LO_IPA_Location_IpAddress) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Table Creation SQL CREATE TABLE ge_wassaid_lo_at ( GE_ID int(11) NOT NULL, LO_ID int(11) NOT NULL, GE_wasSaid_LO_at_ChangedAt datetime NOT NULL, PRIMARY KEY (GE_ID,LO_ID,GE_wasSaid_LO_at_ChangedAt), KEY LO_ID (LO_ID) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; CREATE TABLE us_was_lo_at ( US_ID varchar(64) COLLATE utf8_unicode_ci NOT NULL, LO_ID int(11) NOT NULL, PRIMARY KEY (US_ID,LO_ID), KEY LO_ID (LO_ID) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Table Creation SQL ALTER TABLE `lo_ipa_location_ipaddress` ADD CONSTRAINT lo_ipa_location_ipaddress_ibfk_1 FOREIGN KEY (LO_ID) REFERENCES lo_location (LO_ID); ALTER TABLE `ge_wassaid_lo_at` ADD CONSTRAINT ge_wassaid_lo_at_ibfk_2 FOREIGN KEY (LO_ID) REFERENCES lo_location (LO_ID), ADD CONSTRAINT ge_wassaid_lo_at_ibfk_1 FOREIGN KEY (GE_ID) REFERENCES ge_greeting (GE_ID); ALTER TABLE `us_was_lo_at` ADD CONSTRAINT us_was_lo_at_ibfk_2 FOREIGN KEY (LO_ID) REFERENCES lo_location (LO_ID), ADD CONSTRAINT us_was_lo_at_ibfk_1 FOREIGN KEY (US_ID) REFERENCES us_user (US_ID);
Menampilkan Salam ,[object Object]
Waktu pengucapan salam ( tie   GE_wasSaid_US_by_ChangedAt )
Lokasi pengucapan salam ( attribute   LO_IPA_Location_IpAddress ) ,[object Object],[object Object]
Menampilkan Salam ,[object Object]
JOIN lo_ipa_location_ipaddress lo_ipa ON lo_ipa.LO_ID = lo.LO_ID ,[object Object],[object Object]
JOIN ge_wassaid_lo_at ge_lo ON ge_lo.GE_ID = ge.GE_ID AND ge_lo.LO_ID = lo.LO_ID AND ge_lo.GE_wasSaid_LO_at_ChangedAt = ge_us.GE_wasSaid_US_by_ChangedAt
Menampilkan Salam ,[object Object]
Menampilkan Salam ,[object Object],<sql:query var=&quot;result&quot; dataSource=&quot;jdbc/security&quot;> SELECT ge_txt.GE_TXT_Greeting_Text, ge_us.GE_wasSaid_US_by_ChangedAt, lo_ipa.LO_IPA_Location_IpAddress  FROM us_user us JOIN ge_greeting ge JOIN lo_location lo JOIN ge_txt_greeting_text ge_txt ON ge_txt.GE_ID = ge.GE_ID JOIN lo_ipa_location_ipaddress lo_ipa ON lo_ipa.LO_ID = lo.LO_ID  JOIN ge_wassaid_us_by ge_us ON ge_us.GE_ID = ge.GE_ID AND ge_us.US_ID = us.US_ID JOIN ge_wassaid_lo_at ge_lo ON ge_lo.GE_ID = ge.GE_ID AND ge_lo.LO_ID = lo.LO_ID AND ge_lo.GE_wasSaid_LO_at_ChangedAt = ge_us.GE_wasSaid_US_by_ChangedAt WHERE us.US_ID = '<%= username %>' ORDER BY ge_us.GE_wasSaid_US_by_ChangedAt DESC LIMIT 3 </sql:query>
File Lengkap  /jdbc/index.jsp <%@taglib prefix=&quot;c&quot; uri=&quot;http://java.sun.com/jsp/jstl/core&quot;%> <%@taglib prefix=&quot;sql&quot; uri=&quot;http://java.sun.com/jsp/jstl/sql&quot;%> <%@page contentType=&quot;text/html&quot; pageEncoding=&quot;UTF-8&quot;%> <% String username = ((HttpServletRequest) pageContext.getRequest()).getUserPrincipal().getName(); %> <!DOCTYPE html> <html> <head> <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;>
File Lengkap  /jdbc/index.jsp <title>Otentikasi Berbasis Form dengan Realm JDBC untuk JSP</title> </head> <body> <sql:query var=&quot;sex&quot; dataSource=&quot;jdbc/security&quot;> SELECT SEX_ID FROM us_sex_user_sex WHERE US_ID = '<%= username%>' </sql:query> <c:choose> <c:when test='${sex.rows[0].SEX_ID == &quot;M&quot;}'> <c:set var=&quot;title&quot; value=&quot;Bapak&quot; scope=&quot;page&quot; /> </c:when>
File Lengkap  /jdbc/index.jsp <c:otherwise> <c:set var=&quot;title&quot; value=&quot;Ibu&quot; scope=&quot;page&quot; /> </c:otherwise> </c:choose> <sql:query var=&quot;name&quot; dataSource=&quot;jdbc/security&quot;> SELECT US_NAM_User_Name FROM us_nam_user_name WHERE US_ID = '<%= username%>' </sql:query> <h1>Hello <c:out value=&quot;${title}&quot; /> <c:out value=&quot;${name.rows[0].US_NAM_User_Name}&quot; />!</h1> <form method=&quot;POST&quot; action=&quot;greeting.jsp&quot;> <ul>
File Lengkap  /jdbc/index.jsp <li>Masukkan salam anda: <input type=&quot;text&quot; name=&quot;greeting&quot; /></li> </ul> <input type=&quot;submit&quot; value=&quot;Kirim&quot; /> </form> <p> <sql:query var=&quot;result&quot; dataSource=&quot;jdbc/security&quot;> SELECT ge_txt.GE_TXT_Greeting_Text, ge_us.GE_wasSaid_US_by_ChangedAt, lo_ipa.LO_IPA_Location_IpAddress  FROM us_user us JOIN ge_greeting ge JOIN lo_location lo JOIN ge_txt_greeting_text ge_txt ON ge_txt.GE_ID = ge.GE_ID
File Lengkap  /jdbc/index.jsp JOIN lo_ipa_location_ipaddress lo_ipa ON lo_ipa.LO_ID = lo.LO_ID  JOIN ge_wassaid_us_by ge_us ON ge_us.GE_ID = ge.GE_ID AND ge_us.US_ID = us.US_ID JOIN ge_wassaid_lo_at ge_lo ON ge_lo.GE_ID = ge.GE_ID AND ge_lo.LO_ID = lo.LO_ID AND ge_lo.GE_wasSaid_LO_at_ChangedAt = ge_us.GE_wasSaid_US_by_ChangedAt WHERE us.US_ID = '<%= username %>' ORDER BY ge_us.GE_wasSaid_US_by_ChangedAt DESC LIMIT 3 </sql:query> <table border=&quot;1&quot;> <!-- column headers --> <tr>
File Lengkap  /jdbc/index.jsp <c:forEach var=&quot;columnName&quot; items=&quot;${result.columnNames}&quot;> <th><c:out value=&quot;${columnName}&quot;/></th> </c:forEach> </tr> <!-- column data --> <c:forEach var=&quot;row&quot; items=&quot;${result.rowsByIndex}&quot;> <tr> <c:forEach var=&quot;column&quot; items=&quot;${row}&quot;> <td><c:out value=&quot;${column}&quot;/></td> </c:forEach> </tr>
File Lengkap  /jdbc/index.jsp </c:forEach> </table> </p> <a href=&quot;../logout.jsp&quot;>Logout</a> </body> </html>
Meng insert  Lokasi ,[object Object]
Pertama buka transaksi database.
Lalu cek lokasi di tabel  attribute . ,[object Object],[object Object]

More Related Content

Viewers also liked

The role of information literacy in addressing a specific strand of lifelong ...
The role of information literacy in addressing a specific strand of lifelong ...The role of information literacy in addressing a specific strand of lifelong ...
The role of information literacy in addressing a specific strand of lifelong ...cirving
 
Mengamankan Aplikasi Java EE 6
Mengamankan Aplikasi Java EE 6Mengamankan Aplikasi Java EE 6
Mengamankan Aplikasi Java EE 6Bowo Prasetyo
 
e-Voting Application using Internal Vtoken
e-Voting Application using Internal Vtokene-Voting Application using Internal Vtoken
e-Voting Application using Internal VtokenBowo Prasetyo
 
Konsep Baru Pemodelan Database dengan Anchor Modeling
Konsep Baru Pemodelan Database dengan Anchor ModelingKonsep Baru Pemodelan Database dengan Anchor Modeling
Konsep Baru Pemodelan Database dengan Anchor ModelingBowo Prasetyo
 
Mengamankan Aplikasi Java EE 6
Mengamankan Aplikasi Java EE 6Mengamankan Aplikasi Java EE 6
Mengamankan Aplikasi Java EE 6Bowo Prasetyo
 
Overview of Data Mining
Overview of Data MiningOverview of Data Mining
Overview of Data MiningBowo Prasetyo
 
Copy compu diaposit
Copy compu diapositCopy compu diaposit
Copy compu diapositREQ2010
 
Educacion inclusiva para docentes
Educacion inclusiva para docentesEducacion inclusiva para docentes
Educacion inclusiva para docentesMarta Montoro
 
Leaderonomics Learning
Leaderonomics LearningLeaderonomics Learning
Leaderonomics LearningLeaderonomics
 
Ley federal de proteccion al consumidor
Ley federal de proteccion al consumidorLey federal de proteccion al consumidor
Ley federal de proteccion al consumidorCiscoUnitec
 
Finanzas Intermedias
Finanzas IntermediasFinanzas Intermedias
Finanzas IntermediasUNAD
 
Proposal Section I
Proposal   Section IProposal   Section I
Proposal Section Irmusallam
 
Speed up your GIS server - run GIS software on solid-state drives (SSD)
Speed up your GIS server - run GIS software on solid-state drives (SSD)Speed up your GIS server - run GIS software on solid-state drives (SSD)
Speed up your GIS server - run GIS software on solid-state drives (SSD)Daniel Kastl
 
DSI: préparez-vous à devenir cloud broker!
DSI: préparez-vous à devenir cloud broker!DSI: préparez-vous à devenir cloud broker!
DSI: préparez-vous à devenir cloud broker!Wavestone
 

Viewers also liked (20)

La puntualidad
La puntualidadLa puntualidad
La puntualidad
 
The role of information literacy in addressing a specific strand of lifelong ...
The role of information literacy in addressing a specific strand of lifelong ...The role of information literacy in addressing a specific strand of lifelong ...
The role of information literacy in addressing a specific strand of lifelong ...
 
Mengamankan Aplikasi Java EE 6
Mengamankan Aplikasi Java EE 6Mengamankan Aplikasi Java EE 6
Mengamankan Aplikasi Java EE 6
 
e-Voting Application using Internal Vtoken
e-Voting Application using Internal Vtokene-Voting Application using Internal Vtoken
e-Voting Application using Internal Vtoken
 
Konsep Baru Pemodelan Database dengan Anchor Modeling
Konsep Baru Pemodelan Database dengan Anchor ModelingKonsep Baru Pemodelan Database dengan Anchor Modeling
Konsep Baru Pemodelan Database dengan Anchor Modeling
 
Mengamankan Aplikasi Java EE 6
Mengamankan Aplikasi Java EE 6Mengamankan Aplikasi Java EE 6
Mengamankan Aplikasi Java EE 6
 
Overview of Data Mining
Overview of Data MiningOverview of Data Mining
Overview of Data Mining
 
RELM Overview
RELM OverviewRELM Overview
RELM Overview
 
Copy compu diaposit
Copy compu diapositCopy compu diaposit
Copy compu diaposit
 
Educacion inclusiva para docentes
Educacion inclusiva para docentesEducacion inclusiva para docentes
Educacion inclusiva para docentes
 
Goals And Outcomes
Goals And OutcomesGoals And Outcomes
Goals And Outcomes
 
Leaderonomics Learning
Leaderonomics LearningLeaderonomics Learning
Leaderonomics Learning
 
18 sono vigilia
18 sono vigilia18 sono vigilia
18 sono vigilia
 
Ley federal de proteccion al consumidor
Ley federal de proteccion al consumidorLey federal de proteccion al consumidor
Ley federal de proteccion al consumidor
 
Finanzas Intermedias
Finanzas IntermediasFinanzas Intermedias
Finanzas Intermedias
 
Guide sur la supervision 2009
Guide sur la supervision   2009Guide sur la supervision   2009
Guide sur la supervision 2009
 
Proposal Section I
Proposal   Section IProposal   Section I
Proposal Section I
 
Speed up your GIS server - run GIS software on solid-state drives (SSD)
Speed up your GIS server - run GIS software on solid-state drives (SSD)Speed up your GIS server - run GIS software on solid-state drives (SSD)
Speed up your GIS server - run GIS software on solid-state drives (SSD)
 
DSI: préparez-vous à devenir cloud broker!
DSI: préparez-vous à devenir cloud broker!DSI: préparez-vous à devenir cloud broker!
DSI: préparez-vous à devenir cloud broker!
 
Convivencia Centros Educativos 1
Convivencia Centros Educativos 1Convivencia Centros Educativos 1
Convivencia Centros Educativos 1
 

Konsep Baru Pemodelan Database dengan Anchor Modeling

  • 1. Konsep Baru Pemodelan Database dengan Anchor Modeling Bowo Prasetyo Contoh Kasus Lanjutan Perubahan Struktur dan Konten Database 10 Desember 2011 http://www.scribd.com/prazjp http://www.slideshare.net/bowoprasetyo
  • 2.
  • 3. Berbasis pada empat konstruksi permodelan: anchor , attribute , tie dan knot .
  • 4. Hasilnya dapat diterjemahkan ke desain relational database, di mana hampir semua tabelnya akan berada pada bentuk sixth normal form (6NF).
  • 5.
  • 6. Perubahan Database 3 Perubahan Struktur dan Konten Mencatat Lokasi
  • 7.
  • 8.
  • 9.
  • 10. Berarti tambah anchor baru yang sesuai, dengan satu attribute untuk IP address.
  • 11.
  • 12.
  • 13.
  • 14. Tambahan satu attribute : LO_IPA_Location_IpAddress
  • 15. Tambahan dua tie : GE_wasSaid_LO_at (bersejarah), US_was_LO_at
  • 16.
  • 21. Table Creation SQL CREATE TABLE lo_location ( LO_ID int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (LO_ID) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; CREATE TABLE lo_ipa_location_ipaddress ( LO_ID int(11) NOT NULL, LO_IPA_Location_IpAddress varchar(15) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (LO_ID), UNIQUE KEY LO_IPA_Location_IpAddress (LO_IPA_Location_IpAddress) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  • 22. Table Creation SQL CREATE TABLE ge_wassaid_lo_at ( GE_ID int(11) NOT NULL, LO_ID int(11) NOT NULL, GE_wasSaid_LO_at_ChangedAt datetime NOT NULL, PRIMARY KEY (GE_ID,LO_ID,GE_wasSaid_LO_at_ChangedAt), KEY LO_ID (LO_ID) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; CREATE TABLE us_was_lo_at ( US_ID varchar(64) COLLATE utf8_unicode_ci NOT NULL, LO_ID int(11) NOT NULL, PRIMARY KEY (US_ID,LO_ID), KEY LO_ID (LO_ID) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  • 23. Table Creation SQL ALTER TABLE `lo_ipa_location_ipaddress` ADD CONSTRAINT lo_ipa_location_ipaddress_ibfk_1 FOREIGN KEY (LO_ID) REFERENCES lo_location (LO_ID); ALTER TABLE `ge_wassaid_lo_at` ADD CONSTRAINT ge_wassaid_lo_at_ibfk_2 FOREIGN KEY (LO_ID) REFERENCES lo_location (LO_ID), ADD CONSTRAINT ge_wassaid_lo_at_ibfk_1 FOREIGN KEY (GE_ID) REFERENCES ge_greeting (GE_ID); ALTER TABLE `us_was_lo_at` ADD CONSTRAINT us_was_lo_at_ibfk_2 FOREIGN KEY (LO_ID) REFERENCES lo_location (LO_ID), ADD CONSTRAINT us_was_lo_at_ibfk_1 FOREIGN KEY (US_ID) REFERENCES us_user (US_ID);
  • 24.
  • 25. Waktu pengucapan salam ( tie GE_wasSaid_US_by_ChangedAt )
  • 26.
  • 27.
  • 28.
  • 29. JOIN ge_wassaid_lo_at ge_lo ON ge_lo.GE_ID = ge.GE_ID AND ge_lo.LO_ID = lo.LO_ID AND ge_lo.GE_wasSaid_LO_at_ChangedAt = ge_us.GE_wasSaid_US_by_ChangedAt
  • 30.
  • 31.
  • 32. File Lengkap /jdbc/index.jsp <%@taglib prefix=&quot;c&quot; uri=&quot;http://java.sun.com/jsp/jstl/core&quot;%> <%@taglib prefix=&quot;sql&quot; uri=&quot;http://java.sun.com/jsp/jstl/sql&quot;%> <%@page contentType=&quot;text/html&quot; pageEncoding=&quot;UTF-8&quot;%> <% String username = ((HttpServletRequest) pageContext.getRequest()).getUserPrincipal().getName(); %> <!DOCTYPE html> <html> <head> <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;>
  • 33. File Lengkap /jdbc/index.jsp <title>Otentikasi Berbasis Form dengan Realm JDBC untuk JSP</title> </head> <body> <sql:query var=&quot;sex&quot; dataSource=&quot;jdbc/security&quot;> SELECT SEX_ID FROM us_sex_user_sex WHERE US_ID = '<%= username%>' </sql:query> <c:choose> <c:when test='${sex.rows[0].SEX_ID == &quot;M&quot;}'> <c:set var=&quot;title&quot; value=&quot;Bapak&quot; scope=&quot;page&quot; /> </c:when>
  • 34. File Lengkap /jdbc/index.jsp <c:otherwise> <c:set var=&quot;title&quot; value=&quot;Ibu&quot; scope=&quot;page&quot; /> </c:otherwise> </c:choose> <sql:query var=&quot;name&quot; dataSource=&quot;jdbc/security&quot;> SELECT US_NAM_User_Name FROM us_nam_user_name WHERE US_ID = '<%= username%>' </sql:query> <h1>Hello <c:out value=&quot;${title}&quot; /> <c:out value=&quot;${name.rows[0].US_NAM_User_Name}&quot; />!</h1> <form method=&quot;POST&quot; action=&quot;greeting.jsp&quot;> <ul>
  • 35. File Lengkap /jdbc/index.jsp <li>Masukkan salam anda: <input type=&quot;text&quot; name=&quot;greeting&quot; /></li> </ul> <input type=&quot;submit&quot; value=&quot;Kirim&quot; /> </form> <p> <sql:query var=&quot;result&quot; dataSource=&quot;jdbc/security&quot;> SELECT ge_txt.GE_TXT_Greeting_Text, ge_us.GE_wasSaid_US_by_ChangedAt, lo_ipa.LO_IPA_Location_IpAddress FROM us_user us JOIN ge_greeting ge JOIN lo_location lo JOIN ge_txt_greeting_text ge_txt ON ge_txt.GE_ID = ge.GE_ID
  • 36. File Lengkap /jdbc/index.jsp JOIN lo_ipa_location_ipaddress lo_ipa ON lo_ipa.LO_ID = lo.LO_ID JOIN ge_wassaid_us_by ge_us ON ge_us.GE_ID = ge.GE_ID AND ge_us.US_ID = us.US_ID JOIN ge_wassaid_lo_at ge_lo ON ge_lo.GE_ID = ge.GE_ID AND ge_lo.LO_ID = lo.LO_ID AND ge_lo.GE_wasSaid_LO_at_ChangedAt = ge_us.GE_wasSaid_US_by_ChangedAt WHERE us.US_ID = '<%= username %>' ORDER BY ge_us.GE_wasSaid_US_by_ChangedAt DESC LIMIT 3 </sql:query> <table border=&quot;1&quot;> <!-- column headers --> <tr>
  • 37. File Lengkap /jdbc/index.jsp <c:forEach var=&quot;columnName&quot; items=&quot;${result.columnNames}&quot;> <th><c:out value=&quot;${columnName}&quot;/></th> </c:forEach> </tr> <!-- column data --> <c:forEach var=&quot;row&quot; items=&quot;${result.rowsByIndex}&quot;> <tr> <c:forEach var=&quot;column&quot; items=&quot;${row}&quot;> <td><c:out value=&quot;${column}&quot;/></td> </c:forEach> </tr>
  • 38. File Lengkap /jdbc/index.jsp </c:forEach> </table> </p> <a href=&quot;../logout.jsp&quot;>Logout</a> </body> </html>
  • 39.
  • 41.
  • 42. Insert lokasi dan waktunya di tabel tie .
  • 44. Mengecek Lokasi di Tabel Attribute <sql:transaction dataSource=&quot;jdbc/security&quot;> <sql:query var=&quot;loId&quot;> SELECT LO_ID FROM lo_ipa_location_ipaddress WHERE LO_IPA_Location_IpAddress = '${pageContext.request.remoteAddr}' </sql:query>
  • 45. Meng insert Lokasi di Tabel Anchor <sql:update var=&quot;inserted&quot;> INSERT INTO lo_location (LO_ID) VALUES (NULL) </sql:update>
  • 46. Meng insert Lokasi di Tabel Attribute <sql:query var=&quot;loId&quot;> SELECT LAST_INSERT_ID() LO_ID </sql:query> <sql:update var=&quot;inserted&quot;> INSERT INTO lo_ipa_location_ipaddress (LO_ID, LO_IPA_Location_IpAddress) VALUES (${loId.rows[0].LO_ID}, '${pageContext.request.remoteAddr}') </sql:update>
  • 47. Meng insert Lokasi dan Waktunya di Tabel Tie <sql:update var=&quot;inserted&quot;> INSERT INTO ge_wassaid_lo_at (GE_ID, LO_ID, GE_wasSaid_LO_at_ChangedAt) VALUES (${geId.rows[0].GE_ID}, ${loId.rows[0].LO_ID}, '${now}') </sql:update> </sql:transaction>
  • 48. File Lengkap /jdbc/greeting.jsp <%@taglib prefix=&quot;c&quot; uri=&quot;http://java.sun.com/jsp/jstl/core&quot;%> <%@taglib prefix=&quot;sql&quot; uri=&quot;http://java.sun.com/jsp/jstl/sql&quot;%> <%@page contentType=&quot;text/html&quot; pageEncoding=&quot;UTF-8&quot;%> <% String username = ((HttpServletRequest) pageContext.getRequest()).getUserPrincipal().getName(); %> <!DOCTYPE html> <html> <head> <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;>
  • 49. File Lengkap /jdbc/greeting.jsp <title>Inserting Greeting Page</title> </head> <body> <sql:transaction dataSource=&quot;jdbc/security&quot;> <!-- check if greeting exists in attribute table --> <sql:query var=&quot;geId&quot;> SELECT GE_ID FROM ge_txt_greeting_text WHERE GE_TXT_Greeting_Text = '${param.greeting}' </sql:query> <!-- insert greeting if not exists in attribute table --> <c:if test=&quot;${empty geId.rows[0].GE_ID}&quot;> <!-- first inserts the primary key in anchor table -->
  • 50. File Lengkap /jdbc/greeting.jsp <sql:update var=&quot;inserted&quot;> INSERT INTO ge_greeting (GE_ID) VALUES (NULL) </sql:update> <!-- then inserts text into attribute table if succeeded --> <c:if test=&quot;${inserted > 0}&quot;> <sql:query var=&quot;geId&quot;> SELECT LAST_INSERT_ID() GE_ID </sql:query> <sql:update var=&quot;inserted&quot;>
  • 51. File Lengkap /jdbc/greeting.jsp INSERT INTO ge_txt_greeting_text (GE_ID, GE_TXT_Greeting_Text) VALUES (${geId.rows[0].GE_ID}, '${param.greeting}') </sql:update> <h4>New greeting <c:out value=&quot;${param.greeting}&quot; /> was inserted!</h4> </c:if> </c:if> <!-- insert greeting times into tie otherwise --> <c:set var=&quot;now0&quot; value=&quot;<%=new java.util.Date()%>&quot;/> <fmt:formatDate var=&quot;now&quot; pattern=&quot;yyyy-MM-dd HH:mm:ss&quot; value=&quot;${now0}&quot;/>
  • 52. File Lengkap /jdbc/greeting.jsp <sql:update var=&quot;inserted&quot;> INSERT INTO ge_wassaid_us_by (US_ID, GE_ID, GE_wasSaid_US_by_ChangedAt) VALUES ('<%= username%>', ${geId.rows[0].GE_ID}, ${now}) </sql:update> <h4>Time of <c:out value=&quot;${param.greeting}&quot; /> was recorded!</h4>
  • 53. File Lengkap /jdbc/greeting.jsp <!-- check if location exists in attribute table --> <sql:query var=&quot;loId&quot;> SELECT LO_ID FROM lo_ipa_location_ipaddress WHERE LO_IPA_Location_IpAddress = '${pageContext.request.remoteAddr}' </sql:query> <!-- insert location if not exists in attribute table --> <c:if test=&quot;${empty loId.rows[0].LO_ID}&quot;> <!-- first inserts the primary key in anchor table --> <sql:update var=&quot;inserted&quot;> INSERT INTO lo_location (LO_ID) VALUES (NULL) </sql:update>
  • 54. File Lengkap /jdbc/greeting.jsp <!-- then inserts ip address into attribute table if succeeded --> <c:if test=&quot;${inserted > 0}&quot;> <sql:query var=&quot;loId&quot;> SELECT LAST_INSERT_ID() LO_ID </sql:query> <sql:update var=&quot;inserted&quot;> INSERT INTO lo_ipa_location_ipaddress (LO_ID, LO_IPA_Location_IpAddress) VALUES (${loId.rows[0].LO_ID}, '${pageContext.request.remoteAddr}') </sql:update>
  • 55. File Lengkap /jdbc/greeting.jsp <h4>New location <c:out value=&quot;${pageContext.request.remoteAddr}&quot; /> was inserted!</h4> </c:if> </c:if> <!-- insert location times into tie otherwise --> <sql:update var=&quot;inserted&quot;> INSERT INTO ge_wassaid_lo_at (GE_ID, LO_ID, GE_wasSaid_LO_at_ChangedAt) VALUES (${geId.rows[0].GE_ID}, ${loId.rows[0].LO_ID}, '${now}') </sql:update> </sql:transaction> <h4>Time of <c:out value=&quot;${pageContext.request.remoteAddr}&quot; /> was recorded!</h4>
  • 56. File Lengkap /jdbc/greeting.jsp <a href=&quot;./index.jsp&quot;>Index</a> </body> </html>
  • 57.
  • 58.
  • 59.
  • 60.
  • 61. Anchor Modeling – Wikipedia, http://en.wikipedia.org/wiki/Anchor_Modeling
  • 62. Online Anchor Modeler, http://www.anchormodeling.com/modeler/
  • 63. Anchor Modeling: Naming Convention, http://www.anchormodeling.com/wp-content/uploads/2010/09/AM-Naming.pdf
  • 64. The NetBeans E-commerce Tutorial - Connecting the Application to the Database, http://netbeans.org/kb/docs/javaee/ecommerce/connect-db.html