home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-05-08 | 3.3 KB | 87 lines |
- /*
- * Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
- *
- * This SOURCE CODE FILE, which has been provided by Borland as part
- * of a Borland product for use ONLY by licensed users of the product,
- * includes CONFIDENTIAL and PROPRIETARY information of Borland.
- *
- * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
- * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
- * THE PRODUCT.
- *
- * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
- * COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
- * OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
- * OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
- * OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
- * OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
- * CODE FILE.
- */
- //--------------------------------------------------------------------------------------------------
- // CORBA Reference Application
- // Copyright (c) 1997 by Borland International, All Rights Reserved
- //
- // Conatins DataModule responsible for issuing Credit Cards.
- //--------------------------------------------------------------------------------------------------
-
- package borland.reference.creditapproval.server;
-
- import borland.jbcl.dataset.*;
- public class CreditCardDB implements DataModule{
- private static CreditCardDB myDM;
- Database CreditCardDB;// = new Database();
-
- public CreditCardDB() {
- try {
- jbInit();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void jbInit() throws Exception{
-
- long nextNumber;
- java.sql.Driver icDriver = new borland.interclient.Driver();
- java.sql.Connection TracedConnection;
- java.util.Properties properties = new java.util.Properties();
- properties.put ("user", "SYSDBA");
- properties.put ("password", "masterkey" );
-
- // Turn on all of the trace options
- ((borland.interclient.Driver)icDriver).getMonitor().setTraceStream(System.out);
- ((borland.interclient.Driver)icDriver).getMonitor().enableAllTraces(true);
-
- TracedConnection = icDriver.connect("jdbc:interbase://localhost/C:/CorbaReferenceApplication/DB/Cliffhanger Credit Card.gdb", properties );
- CreditCardDB = new Database( TracedConnection );
-
- // Turn off autoCommit!
- CreditCardDB.setAutoCommit( false );
-
- //CreditCardDB.setConnection(new borland.jbcl.dataset.ConnectionDescriptor("jdbc:interbase://localhost/C:/CorbaReferenceApplication/DB/Cliffhanger Credit Card.gdb", "SYSDBA", "masterkey", false, "borland.interclient.Driver"));
- CreditCardDB.setSQLDialect(borland.jbcl.dataset.SQLDialect.INTERBASE);
- //CreditCardDB.openConnection();
- java.sql.Statement statement = CreditCardDB.createStatement() ;
- statement.executeUpdate("UPDATE CARD_NUMBER SET NUMBER = NUMBER + 1");
- java.sql.ResultSet results = statement.executeQuery("SELECT CARD_NUMBER.NUMBER FROM CARD_NUMBER");
-
- // Move to first row in the result set!
- results.next();
- nextNumber = results.getLong("NUMBER");
- CreditCardDB.commit();
- System.out.println( "Number Returned is: " + nextNumber);
-
- }
-
- static public CreditCardDB getDataModule() {
- if (myDM == null)
- myDM = new CreditCardDB();
- return myDM;
- }
- public void IssueCreditCard() {
- }
-
-
- }
-