This discussion is archived
1 Reply Latest reply: Apr 12, 2013 2:39 AM by ChrisJenkins RSS

TimesTen 11 DatabaseMetaData.getProcedures(xxx) doesn't work?

967223 Newbie
Currently Being Moderated
I have TimesTen DB TT_1122 installed with default configuration.

I have the procedures with name PROC_TEST123 already inside a TT_1122, and from ttisql, I can see it (by procedures call).
When I used the DatabaseMetaData.getProcedures() to get Procedure, it returns nothing.

Any idea?
Any suggestion to make it work?
Can/How I turn on timesten to support it (if it is disabled)?
Any other way to get procedures instead of DatabaseMetaData.getProcedures() which will work with TT?

Here is more information:

From ttisql, I can see two procedures:
Command> procedures;
NOBODY.DUMMY_SELECT
NOBODY.PROC_TEST123
2 procedures found.
Command>

When using the jdbc code below, I got output:

java -jar TT_test.jar PROC_TEST123 lablogin passwd
Using direct connection : TT_1122
connected to TT_1122 successfully
Support Schemas: false
Support Catalogs: false
Catalogs null
inside getProcedure proc=PROC_TEST123
inside getProcedure catalog=null
inside getProcedure schema=null
close the connection

============================
The code:
public class Test2 {

private static void getProcedure(final DatabaseMetaData dbmd,
final String catalog, String schema, final String proc)
throws SQLException {

System.out.println("inside getProcedure proc=" + proc);
System.out.println("inside getProcedure catalog=" + catalog);
System.out.println("inside getProcedure schema=" + schema);

ResultSet rs = null;
try {
rs = dbmd.getProcedures(catalog, schema, proc);
if (rs == null) {
System.out.println("Dont find the procedure with name " + proc);
}

if (rs.next()) {
do {
System.out.println("resultSet = " + rs.toString());
} while (rs.next());
}
} finally {
}
}

public static void main(String[] args) {
Connection con = null;

if (args.length != 3) {
System.out.println("Test2 proc_name user passwd");
System.exit(0);
}

String proc = args[0];
String user = args[1];
String passwd = args[2];

try {
TimesTenDataSource ds = new TimesTenDataSource();

String URL = "jdbc:timesten:direct:TT_1122";
ds.setUrl(URL);
ds.setUser(user);
ds.setOraclePassword(passwd);
ds.setPassword(passwd);
con = ds.getConnection();

System.out.println("\nconnected to TT_1122 successfully");

final DatabaseMetaData dbmd = con.getMetaData();
final boolean isSupportsSchemas = dbmd.supportsSchemasInProcedureCalls();
final boolean isSupportsCatalogs = dbmd.supportsCatalogsInProcedureCalls();

System.out.println("Support Schemas: " + isSupportsSchemas);
System.out.println("Support Catalogs: " + isSupportsCatalogs);

String catalog = con.getCatalog();
System.out.println("Catalogs " + catalog);

getProcedure(dbmd, catalog, null, proc);

} catch (SQLException ex) {
try {
if (con != null)
con.rollback();
} catch (SQLException e) {
}
System.out.println("SQLException: " + ex.toString());
} finally {
try {
if ((con != null) && !con.isClosed()) {
System.out.println("\nClosing the connection\n");
con.close();
}
} catch (SQLException ex) {
}
}
}
}

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points