00001 #ifndef _DBCONNECTION_H_ 00002 #define _DBCONNECTION_H_ 00003 00004 #include<occi.h> 00005 #include<stdio.h> 00006 #include<iostream> 00007 #include "../Exceptions/Exception.h" 00008 00009 using namespace oracle::occi; 00010 using namespace std; 00011 using namespace ILCException; 00012 00017 class DBConnection{ 00018 00019 private: 00020 string database; 00021 string user; 00022 string password; 00023 Environment *env; 00024 Connection *conn; 00025 00026 static DBConnection* handle; 00027 DBConnection(); 00028 00029 public: 00034 static DBConnection* getConnection(); 00035 ~DBConnection(); 00036 00041 void setUser(string u); 00046 void setPassword(string p); 00051 void setDatabase(string d); 00052 00057 bool isConnected(); 00061 void connect(); 00062 00066 void disconnect(); 00067 00073 Statement* createStatement(string q); 00074 00075 00080 void terminateStatement(Statement* s); 00081 00085 void commit(); 00086 00090 void rollback(); 00091 00095 Clob* createClob(); 00096 00097 }; 00098 #endif