Edge Database connection achieved

I’m able to connect to the database with edge using Jython scripting. But i would like to know the reason, why ignition is not allowing database connection? Can i go ahead with this scripting method?

Can you share the script/method?

from java.util import Properties
import org.postgresql.Driver as Driver

props = Properties()
props.put(‘user’, ‘postgres’)
props.put(‘password’, ‘pgpass’)
conn = Driver().connect(‘jdbc:postgresql://127.0.0.1’, props)
st = conn.createStatement();
rs = st.executeQuery(‘SELECT “Score” FROM public.“Employee” WHERE “SlNo” = 1’)

if (rs.next()):
print rs.getInt(1)

rs.close()
st.close()

1 Like

@zxcslo shared

1 Like

Congrats, you found a loophole :slight_smile:

This is an intentional restriction of functionality for Edge.

We may or may not close this loophole, use it at your own risk.

3 Likes

@Kevin.Herron Thank you… :slight_smile: