Source Code Cross Referenced for MakeDB.java in  » Database-ORM » tro-community-7.2-1 » allinone » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » tro community 7.2 1 » allinone 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package allinone;
002:
003:        import java.sql.*;
004:
005:        public class MakeDB {
006:            public static void main(String[] argv) throws Throwable {
007:                Class.forName("org.hsqldb.jdbcDriver");
008:                Connection conn = DriverManager.getConnection(
009:                        "jdbc:hsqldb:allinoneDB", "sa", "");
010:                Statement stmt = conn.createStatement();
011:                stmt
012:                        .execute("create table TableDCC (oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER , somedata VARCHAR (32) NOT NULL , reftod DECIMAL (19,0) NOT NULL)");
013:                stmt.close();
014:                stmt = conn.createStatement();
015:                stmt
016:                        .execute("create table TableNDCC (oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER , somedata VARCHAR (32) NOT NULL , reftod DECIMAL (19,0) NOT NULL)");
017:                stmt.close();
018:                stmt = conn.createStatement();
019:                stmt
020:                        .execute("create table TableCRC (oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER , somedata VARCHAR (32) NOT NULL , reftoa DECIMAL (19,0))");
021:                stmt.close();
022:                stmt = conn.createStatement();
023:                stmt
024:                        .execute("create table personSelfRef (oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER , login VARCHAR (32) NOT NULL , password VARCHAR (32) NOT NULL , firstname VARCHAR (32) NOT NULL , lastname VARCHAR (32) NOT NULL , boss DECIMAL (19,0))");
025:                stmt.close();
026:                stmt = conn.createStatement();
027:                stmt
028:                        .execute("create table personT (oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER , login VARCHAR (32) NOT NULL , password VARCHAR (32) NOT NULL , firstname VARCHAR (32) NOT NULL , lastname VARCHAR (32) NOT NULL , favouredDisc DECIMAL (19,0))");
029:                stmt.close();
030:                stmt = conn.createStatement();
031:                stmt
032:                        .execute("create table TableDCA (oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER , somedata VARCHAR (32) NOT NULL , reftob DECIMAL (19,0) NOT NULL , reftoc DECIMAL (19,0) NOT NULL)");
033:                stmt.close();
034:                stmt = conn.createStatement();
035:                stmt
036:                        .execute("create table TableNDCA (oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER , somedata VARCHAR (32) NOT NULL , reftob DECIMAL (19,0) NOT NULL , reftoc DECIMAL (19,0) NOT NULL)");
037:                stmt.close();
038:                stmt = conn.createStatement();
039:                stmt
040:                        .execute("create table TableCRA (oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER , somedata VARCHAR (32) NOT NULL , reftob DECIMAL (19,0))");
041:                stmt.close();
042:                stmt = conn.createStatement();
043:                stmt
044:                        .execute("create table discT (oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER , title VARCHAR (32) NOT NULL , artist VARCHAR (32) NOT NULL , genre VARCHAR (32) NOT NULL , owner DECIMAL (19,0) NOT NULL , isLiked INTEGER NOT NULL)");
045:                stmt.close();
046:                stmt = conn.createStatement();
047:                stmt
048:                        .execute("create table TableCRB (oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER , somedata VARCHAR (32) NOT NULL , reftoc DECIMAL (19,0))");
049:                stmt.close();
050:                stmt = conn.createStatement();
051:                stmt
052:                        .execute("create table TableNDCB (oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER , somedata VARCHAR (32) NOT NULL , reftod DECIMAL (19,0) NOT NULL)");
053:                stmt.close();
054:                stmt = conn.createStatement();
055:                stmt
056:                        .execute("create table TableDCB (oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER , somedata VARCHAR (32) NOT NULL , reftod DECIMAL (19,0) NOT NULL)");
057:                stmt.close();
058:                stmt = conn.createStatement();
059:                stmt
060:                        .execute("create table TableDCD (oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER , somedata VARCHAR (32) NOT NULL)");
061:                stmt.close();
062:                stmt = conn.createStatement();
063:                stmt
064:                        .execute("create table TableNDCD (oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER , somedata VARCHAR (32) NOT NULL)");
065:                stmt.close();
066:                stmt = conn.createStatement();
067:                stmt.execute("create table ObjectId (nextoid DECIMAL (19,0))");
068:                stmt.close();
069:                stmt = conn.createStatement();
070:                stmt
071:                        .execute("create table tableA2 ( oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER  NOT NULL , somedata VARCHAR (32) NOT NULL)");
072:                stmt.close();
073:                stmt = conn.createStatement();
074:                stmt
075:                        .execute("create table tableC2 ( oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER  NOT NULL , somedata VARCHAR (32) NOT NULL , reftoa DECIMAL (19,0), reftob DECIMAL (19,0))");
076:                stmt.close();
077:                stmt = conn.createStatement();
078:                stmt
079:                        .execute("create table tableB2 ( oid DECIMAL (19,0) NOT NULL PRIMARY KEY, version INTEGER  NOT NULL , somedata VARCHAR (32) NOT NULL , reftoa DECIMAL (19,0) , reftob DECIMAL (19,0));");
080:                stmt.close();
081:                conn.commit();
082:                conn.close();
083:
084:                conn = DriverManager.getConnection("jdbc:hsqldb:allinoneDB",
085:                        "sa", "");
086:                stmt = conn.createStatement();
087:                stmt
088:                        .execute("ALTER TABLE TableDCC ADD CONSTRAINT FK_TableDCC_1 FOREIGN KEY (reftod) REFERENCES TableDCD (oid)");
089:                stmt.close();
090:                stmt = conn.createStatement();
091:                stmt
092:                        .execute("ALTER TABLE TableNDCC ADD CONSTRAINT FK_TableNDCC_1 FOREIGN KEY (reftod) REFERENCES TableNDCD (oid)");
093:                stmt.close();
094:                stmt = conn.createStatement();
095:                stmt
096:                        .execute("ALTER TABLE TableCRC ADD CONSTRAINT FK_TableCRC_1 FOREIGN KEY (reftoa) REFERENCES TableCRA (oid)");
097:                stmt.close();
098:                stmt = conn.createStatement();
099:                stmt
100:                        .execute("ALTER TABLE personSelfRef ADD CONSTRAINT FK_personSelfRef_1 FOREIGN KEY (boss) REFERENCES personSelfRef (oid)");
101:                stmt.close();
102:                stmt = conn.createStatement();
103:                stmt
104:                        .execute("ALTER TABLE personT ADD CONSTRAINT FK_personT_1 FOREIGN KEY (favouredDisc) REFERENCES discT (oid)");
105:                stmt.close();
106:                stmt = conn.createStatement();
107:                stmt
108:                        .execute("ALTER TABLE TableDCA ADD CONSTRAINT FK_TableDCA_1 FOREIGN KEY (reftob) REFERENCES TableDCB (oid)");
109:                stmt.close();
110:                stmt = conn.createStatement();
111:                stmt
112:                        .execute("ALTER TABLE TableDCA ADD CONSTRAINT FK_TableDCA_2 FOREIGN KEY (reftoc) REFERENCES TableDCC (oid)");
113:                stmt.close();
114:                stmt = conn.createStatement();
115:                stmt
116:                        .execute("ALTER TABLE TableNDCA ADD CONSTRAINT FK_TableNDCA_1 FOREIGN KEY (reftob) REFERENCES TableNDCB (oid)");
117:                stmt.close();
118:                stmt = conn.createStatement();
119:                stmt
120:                        .execute("ALTER TABLE TableNDCA ADD CONSTRAINT FK_TableNDCA_2 FOREIGN KEY (reftoc) REFERENCES TableNDCC (oid)");
121:                stmt.close();
122:                stmt = conn.createStatement();
123:                stmt
124:                        .execute("ALTER TABLE TableCRA ADD CONSTRAINT FK_TableCRA_1 FOREIGN KEY (reftob) REFERENCES TableCRB (oid)");
125:                stmt.close();
126:                stmt = conn.createStatement();
127:                stmt
128:                        .execute("ALTER TABLE discT ADD CONSTRAINT FK_discT_1 FOREIGN KEY (owner) REFERENCES personT (oid)");
129:                stmt.close();
130:                stmt = conn.createStatement();
131:                stmt
132:                        .execute("ALTER TABLE TableCRB ADD CONSTRAINT FK_TableCRB_1 FOREIGN KEY (reftoc) REFERENCES TableCRC (oid)");
133:                stmt.close();
134:                stmt = conn.createStatement();
135:                stmt
136:                        .execute("ALTER TABLE TableNDCB ADD CONSTRAINT FK_TableNDCB_1 FOREIGN KEY (reftod) REFERENCES TableNDCD (oid)");
137:                stmt.close();
138:                stmt = conn.createStatement();
139:                stmt
140:                        .execute("ALTER TABLE TableDCB ADD CONSTRAINT FK_TableDCB_1 FOREIGN KEY (reftod) REFERENCES TableDCD (oid)");
141:                stmt.close();
142:                stmt = conn.createStatement();
143:                stmt
144:                        .execute("ALTER TABLE tableC2 ADD CONSTRAINT tableC2_reftoa FOREIGN KEY (reftoa) REFERENCES tableA2 (oid)");
145:                stmt.close();
146:                stmt = conn.createStatement();
147:                stmt
148:                        .execute("ALTER TABLE tableC2 ADD CONSTRAINT tableC2_reftob FOREIGN KEY (reftob) REFERENCES tableB2 (oid)");
149:                stmt.close();
150:                stmt = conn.createStatement();
151:                stmt
152:                        .execute("ALTER TABLE tableB2 ADD CONSTRAINT tableB2_reftoa FOREIGN KEY (reftoa) REFERENCES tableA2 (oid)");
153:                stmt.close();
154:                stmt = conn.createStatement();
155:                stmt
156:                        .execute("ALTER TABLE tableB2 ADD CONSTRAINT tableB2_reftob FOREIGN KEY (reftob) REFERENCES tableB2 (oid)");
157:                stmt.close();
158:                conn.commit();
159:                conn.close();
160:            }
161:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.