That's a snippet to test JDBC connection to Oracle with minimum number of lines.
1. Run Groovy shell with ojdbc6.jar on the classpath:
2. Run the script:
In the end it turned out to be a problem described here:
http://appsdbastuff.blogspot.com/2012/01/starting-listener-fails-with-tns-12557.html
In short, the solution was to run this as root:
1. Run Groovy shell with ojdbc6.jar on the classpath:
groovysh -cp /opt/sqldeveloper/jdbc/lib/ojdbc6.jar2. Run the script:
import groovy.sql.Sql
sql = Sql.newInstance('jdbc:oracle:thin:@localhost:1521:mysid',
'user', 'password', 'oracle.jdbc.OracleDriver')
result = sql.firstRow("select * from dual")===> {DUMMY=X}In the end it turned out to be a problem described here:
http://appsdbastuff.blogspot.com/2012/01/starting-listener-fails-with-tns-12557.html
In short, the solution was to run this as root:
mkdir /var/tmp/.oracle chmod 01777 /var/tmp/.oracle chown root /var/tmp/.oracle chgrp root /var/tmp/.oracle
Brak komentarzy:
Prześlij komentarz