01: /*
02: * Copyright (C) CollabraSpace Inc. All rights reserved.
03: */
04: package adhoc;
05:
06: import java.sql.Connection;
07: import java.sql.DatabaseMetaData;
08: import java.sql.DriverManager;
09: import java.sql.ResultSet;
10: import java.sql.SQLException;
11:
12: import net.sourceforge.squirrel_sql.client.ApplicationArguments;
13:
14: public class OracleSynonymTest {
15:
16: String jdbcDriver = "oracle.jdbc.OracleDriver";
17:
18: String jdbcUrl = "jdbc:oracle:thin:@localhost:1521:csuite";
19:
20: String user = "c2";
21:
22: String pass = "password";
23:
24: Connection con = null;
25:
26: String catalog = null;
27: String schema = "C2";
28: String synonym = "FOO";
29:
30: public OracleSynonymTest() throws Exception {
31: init();
32: }
33:
34: public void init() throws Exception {
35: ApplicationArguments.initialize(new String[0]);
36: Class.forName(jdbcDriver);
37: con = DriverManager.getConnection(jdbcUrl, user, pass);
38: }
39:
40: /**
41: * This fails with a Connection failure - java.io.EOFException
42: * @throws SQLException
43: */
44: public void doTest() throws SQLException {
45: ResultSet rs = con.getMetaData().getColumns(catalog, schema,
46: synonym, "%");
47: while (rs.next()) {
48: System.out.println("Column=" + rs.getString("COLUMN_NAME"));
49: }
50: }
51:
52: public void shutdown() throws SQLException {
53: con.close();
54: }
55:
56: /**
57: * @param args
58: */
59: public static void main(String[] args) throws Exception {
60: // TODO Auto-generated method stub
61: OracleSynonymTest test = new OracleSynonymTest();
62:
63: test.doTest();
64:
65: test.shutdown();
66: }
67:
68: }
|