@Override public String getDriverClass() { if ( getAccessType() == DatabaseMeta.TYPE_ACCESS_NATIVE ) { if ( Utils.isEmpty( getHostname() ) ) { return "org.apache.derby.jdbc.EmbeddedDriver"; } else { return "org.apache.derby.jdbc.ClientDriver"; } } else { return "sun.jdbc.odbc.JdbcOdbcDriver"; // ODBC bridge } }
/** * Generates the SQL statement to add a column to the specified table For this generic type, i set it to the most * common possibility. * * @param tablename * The table to add * @param v * The column defined as a value * @param tk * the name of the technical key field * @param use_autoinc * whether or not this field uses auto increment * @param pk * the name of the primary key field * @param semicolon * whether or not to add a semi-colon behind the statement. * @return the SQL statement to add a column to the specified table */ @Override public String getAddColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon ) { return "ALTER TABLE " + tablename + " ADD " + getFieldDefinition( v, tk, pk, use_autoinc, true, false ); }
/** * @see DatabaseInterface#getNotFoundTK(boolean) */ @Override public int getNotFoundTK( boolean use_autoinc ) { if ( supportsAutoInc() && use_autoinc ) { return 0; } return super.getNotFoundTK( use_autoinc ); }
@Override public String getURL( String hostname, String port, String databaseName ) { if ( getAccessType() == DatabaseMeta.TYPE_ACCESS_NATIVE ) { if ( !Utils.isEmpty( hostname ) ) { String url = "jdbc:derby://" + hostname; if ( !Utils.isEmpty( port ) ) { url += ":" + port; } url += "/" + databaseName; return url; } else { // Simple format: jdbc:derby:<dbname> return "jdbc:derby:" + databaseName; } } else { return "jdbc:odbc:" + databaseName; } }
/** * Generates the SQL statement to modify a column in the specified table * * @param tablename * The table to add * @param v * The column defined as a value * @param tk * the name of the technical key field * @param use_autoinc * whether or not this field uses auto increment * @param pk * the name of the primary key field * @param semicolon * whether or not to add a semi-colon behind the statement. * @return the SQL statement to modify a column in the specified table */ @Override public String getModifyColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon ) { return "ALTER TABLE " + tablename + " ALTER " + getFieldDefinition( v, tk, pk, use_autoinc, true, false ); }