Clarity will allow this but it's not as easy as referencing some variables. To pull data from the database (correctly) requires a web service approach.
That involves using some javascript as your html portlet to take the sessionId from the cookie and compose a web service request to Clarity to run a query (or XOG output some data), which you then parse and display in your portlet as the results come back using XSL Transformations to turn the XML response into a HTML table or DIVs/SPANs section.
We've used the same javascript function that can be found here for (easily) fetching the sessionId value from the cookie:
http://www.w3schools.com/js/js_cookies.asp
And this one for taking the XML response of the SOAP request and transforming it with some XSL:
http://www.w3schools.com/xsl/xsl_client.asp
If you have an NSQL query all ready to try, you could test with the file I'm attaching as the body of your HTML portlet to reference it. It isn't bullet-proof but serves as an example of putting these elements together, you'll just need to make a change near the top of the file to reference your own NSQL's query ID:
<script type="text/javascript">
// <!--
// change this to your own NSQL query's ID
var nsql_id = "hgrid_multipage"; // <-- change this value
// -->
</script>
...
Hopefully that gives you a starting point at least.
-Nick