Skip to content

Commit

Permalink
Initialise list sample
Browse files Browse the repository at this point in the history
  • Loading branch information
obiwanchinobi committed Jan 19, 2012
0 parents commit 96edfe4
Show file tree
Hide file tree
Showing 5 changed files with 1,448 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
*.DS_Store
bin/*
7 changes: 7 additions & 0 deletions build.sh
@@ -0,0 +1,7 @@
#!/bin/bash
# javac -d bin src/xep/samples/*.java

# sourcepath: reference the other source files e.g. Core.java
# classpath: reference the class files and libraries e.g. class and jar extensions
# javac -d bin -sourcepath src -classpath bin:$CLASSPATH src/xep/test/Basic.java
javac -d bin -classpath bin:$CLASSPATH src/BindingExamples.java
2 changes: 2 additions & 0 deletions run.sh
@@ -0,0 +1,2 @@
#!/bin/bash
java -classpath bin:$CLASSPATH BindingExamples
50 changes: 50 additions & 0 deletions src/BindingExamples.java
@@ -0,0 +1,50 @@
import koorong.*;
import java.sql.*;
import com.intersys.objects.*;

public class BindingExamples {
public static void main(String[] args){
try {
Database db = getDatabase();
System.out.println("\nConnected to DB... ");

CreateBlankBook(db);
CreateBook(db);
}
catch (Exception ex) {
System.out.println("Caught exception: " + ex.getClass().getName() + ": " + ex.getMessage());
}
}

public static Database getDatabase() throws CacheException{
String url="jdbc:Cache://localhost:56121/USER";
String username="_SYSTEM";
String pwd="SYS";
Database db = CacheDatabase.getDatabase(url, username, pwd);
return db;
}

public static void CreateBlankBook(Database db) {
try {
Book book = new Book(db);
System.out.println("Created new Book... ");

int success = book.save();
System.out.println("Saved Book... ");
}
catch (Exception ex) {
System.out.println("Caught exception: " + ex.getClass().getName() + ": " + ex.getMessage());
}
}

// CreateBook (com.intersys.objects.Database db, java.util.List tags) throws com.intersys.objects.CacheException {
public static void CreateBook(Database db) {
try {
CreateBook(db);
System.out.println("Called CreateBook function... ");
}
catch (Exception ex) {
System.out.println("Caught exception: " + ex.getClass().getName() + ": " + ex.getMessage());
}
}
}

0 comments on commit 96edfe4

Please sign in to comment.