/*
 * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

/*
 * @(#)csSchema.java	1.11 02/01/12
 */
package com.sun.cts.tests.jdbc.ee.common;

import java.io.*;
import java.util.*;
import java.sql.*;

import com.sun.cts.util.*;
import com.sun.cts.harness.*;

import java.rmi.RemoteException;


/**
 * The csSchema class creates the database and procedures using 
 * Sun's J2EE Reference Implementation.
 * @author  
 * @version 1.7, 06/16/99
 */

public class csSchema extends ServiceEETest  
{
	private Properties props = null;
			  

	public void dbUnConnect(Connection conn) throws RemoteException 
	{
		TestUtil.logTrace("dbUnConnect");
		// Close the DB connections
		try
		{
			conn.close();
			TestUtil.logMsg("Closed database connection");
		} 
		catch (Exception e) 
		{
			TestUtil.logErr("Exception occured while trying to close the DB connection");
			throw new RemoteException( e.getMessage() );
		}
	}
	
	public boolean supportsType(String dataTypeParam,Connection conn) {
		
		boolean retValue = false;
	
		try {
			
			logMsg("Creating DBMetaData Object");
			DatabaseMetaData dbmeta = conn.getMetaData();
			String keyWords = dbmeta.getSQLKeywords();
			logMsg("Supported Keywords :" +keyWords);
			
			StringTokenizer strToken = new StringTokenizer(keyWords,",");
			while(strToken.hasMoreElements()) {

				if(dataTypeParam.equalsIgnoreCase(strToken.nextToken()) )
					retValue=true;
			}

		}catch(Exception ex2) {
			
			logMsg("Exception in supportsType method " +ex2);
		 }
		
		return retValue;
	}
	
}
