Home » Developer & Programmer » JDeveloper, Java & XML » Trying to extract Check Constraint Search Conditionson Using JDBC
Trying to extract Check Constraint Search Conditionson Using JDBC [message #92830] Mon, 14 February 2005 07:32
Alex Perry
Messages: 1
Registered: February 2005
Junior Member
Hello.

I am trying to extract the search conditions of check constraints from a few tables on Oracle 9.2.0.1. and Java 1.4.2.

Here is my code:

Vector checks = new Vector();
String sql = "select C.COLUMN_NAME, U.SEARCH_CONDITION ";
sql = sql + "from USER_CONSTRAINTS U, USER_CONS_COLUMNS C ";
sql = sql + "where U.TABLE_NAME = ";
sql = sql + "'" + table + "' ";
sql = sql + "and U.CONSTRAINT_TYPE = 'C' ";

rs = client.processQuery(sql); //rs is a ResultSet and client is a JDBCClient

while (rs.next()) {
System.out.println(rs.getLong("SEARCH_CONDITION")); //this throws an SQLException
checks.addElement(rs.getString("COLUMN_NAME")); //this works fine
}

here is the SQLException that I get:

java.sql.SQLException: Message file 'oracle.jdbc.dbaccess.Messages' is missing.
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:273)
at oracle.jdbc.dbaccess.DBDataSetImpl.getStreamItem(DBDataSetImpl.java:1087)
at oracle.jdbc.driver.OracleStatement.getBytesInternal(OracleStatement.java:2489)
at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:3170)
at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:335)
at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1432)
at edu.wpi.cs.dsrg.xmldb.common.ASG.XAT2ASG.getKeysAndConstraints(XAT2ASG.java:740) <-- this is where the System.out.println(rs.getLong("SEARCH_CONDITION")); call is.
at edu.wpi.cs.dsrg.xmldb.common.ASG.XAT2ASG.convertXAT2ASGs(XAT2ASG.java:302)
at edu.wpi.cs.dsrg.xmldb.UFilter.test.TestXAT2ASG.main(TestXAT2ASG.java:53)

When I get the ResultSet's metadata, it tells me that there are two columns and the second is named "SEARCH_CONDITION" and is of type "LONG" but I cant get it out, no matter what I try. Can anyone please help?
Previous Topic: jdbc connectivity for sqlserver
Next Topic: Connectivity of ORACLE with VB/JAVA
Goto Forum:
  


Current Time: Mon Nov 25 18:04:34 CST 2024