Is it possible in scriptella to get the data using sql request and access it into java code? Something like following:
    <connection id="metadata" url="jdbc:postgresql://localhost:5432/testDB" driver="scriptella.driver.postgresql.Driver" user="user" password="password" classpath="postgresql.jar"/>
    <connection id="java" driver="scriptella.driver.janino.Driver"/>
    <query connection-id="metadata">
        SELECT dataid FROM header_table;
        <query connection-id="java">
            System.out.println(?{dataid});
        </query>
    </query>
 
                        
Sure, it is possible in Janino or other scripting languages like JEXL or JS. Since Java is statically typed, you have to use get('name') method for accessing the variable:
Janino driver JavaDoc provides more details.