Code example for Connection

Methods: createStatementgetMetaData

0
        Connection con = null;
        try { 
            con = connectionManager.getConnection();
 
            // check if the word_probability table exists  
            DatabaseMetaData dbm = con.getMetaData();
            ResultSet rs = dbm.getTables(null, null, "word_probability", null);
            if (!rs.next()) {
                // the table does not exist 
                Statement stmt = con.createStatement();
                //	Under Axion 1.0M1, use 			 
                //	 stmt.executeUpdate( "CREATE TABLE word_probability ( " 
                //			+ " word			VARCHAR(255) NOT NULL," 
                //			+ " category		VARCHAR(20) NOT NULL," 
                //			+ " match_count		INTEGER NOT NULL," 
                //			+ " nonmatch_count	INTEGER NOT NULL, " 
                //			+ " PRIMARY KEY(word, category) ) ");				 
                stmt.executeUpdate("CREATE TABLE word_probability ( " 
                            + " word			VARCHAR(255) NOT NULL,"  
                            + " category		VARCHAR(20) NOT NULL,"  
Contextual code suggestions in your IDE  Get Codota for Java