Jalapeño Tutorial
Quick Start: DBService.java
[Back] [Next]
   
Server:docs1
Instance:LATEST
User:UnknownUser
 
-
Search:    

package basic;

import com.jalapeno.ApplicationContext;
import com.jalapeno.ObjectManager;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Iterator;


public class DBService{

private ObjectManager objectManager;

public DBService ()
      throws Exception
  {
        String           host = "localhost";
        String           username="_SYSTEM";  // null for default
        String           password="SYS";  // null for default

        String           url="jdbc:Cache://" + host + ":1972/USER";

        Class.forName ("com.intersys.jdbc.CacheDriver");
        Connection connection =  
                      DriverManager.getConnection (url, username, password);
        objectManager = ApplicationContext.createObjectManager (connection);
    }
 protected void saveContact(Contact contact )
 throws Exception
 {
    objectManager.save(contact, true);
       
 }
protected Iterator allContacts ()
throws Exception
 {
    return objectManager.openByQuery (Contact.class, null, null);
 }  

}