private void createDatabaseIfNeeded()
   {
      try
      {
         Connection connection = getConnection();
         connection.setAutoCommit(true);
         sqlStatement = connection.createStatement();
         
         boolean clientExists = false, itemExists = false;
         
         int tableNameColumn = 3;
         DatabaseMetaData dbm = connection.getMetaData();
         for (ResultSet rs = dbm.getTables(null, null, null, null); rs.next();)
         {
            String tableName = rs.getString(tableNameColumn);
            
            if (tableName.equalsIgnoreCase("customer"))
            {
               clientExists = true;
               
               if (itemExists)
               {
                  rs.close();
                  break;
               }
            }
            else if (tableName.equalsIgnoreCase("item"))
            {
               itemExists = true;
               
               if (clientExists)
               {
                  rs.close();
                  break;
               }
            }
         }
         
         if (!clientExists)
         {
            sqlStatement.executeUpdate("CREATE TABLE customer (" + 
                                          "name VARCHAR(32) PRIMARY KEY," + 
                                          "password VARCHAR(32)," +
                                          "sold INTEGER," +
                                          "bought INTEGER" +
                                       ")" );
         }
         
         if (!itemExists)
         {
            sqlStatement.executeUpdate("CREATE TABLE item (" + 
                                          "id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1)," +
                                          "itemName VARCHAR(32)," + 
                                          "price FLOAT," +
                                          "name VARCHAR(32)," +
                                          "wish INTEGER" +
                                       ")");
         }
      }
      catch (Exception e)
      {
         System.err.println("Error retrieving the database.");
         System.exit(1);
      }
   }