Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String strConnectionURL = "jdbc:derby:/path/to/derby/database;create=false";
- Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
- Connection connection = DriverManager.getConnection(strConnectionURL);
- Statement statement = connection.createStatement();
- boolean boResult = statement.execute("SHOW TABLES");
- if (boResult) {
- System.out.println("yay!");
- }
- java.sql.SQLSyntaxErrorException: Syntax error: Encountered "SHOW" at line 1, column 1.
- String strConnectionURL = "jdbc:derby:/path/to/derby/db;create=false";
- Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
- Connection connection = DriverManager.getConnection(strConnectionURL);
- CallableStatement statement = connection.prepareCall("SHOW TABLES");
- boolean boResult = statement.execute();
- if (boResult) {
- System.out.println("yippee!");
- }
- java.sql.SQLSyntaxErrorException: Syntax error: Encountered "SHOW" at line 1, column 1.
- String strConnectionURL = "jdbc:derby:/path/to/db;create=false";
- Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
- Connection connection = DriverManager.getConnection(strConnectionURL);
- DatabaseMetaData dbmd = connection.getMetaData();
- ResultSet resultSet = dbmd.getTables(null, null, null, null);
- while (resultSet.next()) {
- String strTableName = resultSet.getString("TABLE_NAME");
- System.out.println("TABLE_NAME is " + strTableName);
- }
- public void showTbls() throws Exception{
- String sqlIn = "SHOW TABLES;";
- InputStream stream = new ByteArrayInputStream(sqlIn.getBytes(StandardCharsets.UTF_8));
- ij.runScript(conn,stream,StandardCharsets.UTF_8.name(), System.out,"UTF-8");
- stream.close();
- }
- Statement stmt = conn.createStatement();
- ResultSet results = stmt.executeQuery("SELECT * FROM sys.systables");
- ResultSet results = stmt.executeQuery("SELECT TABLENAME FROM SYS.SYSTABLES WHERE TABLETYPE='T'");
Add Comment
Please, Sign In to add comment