Lines 164-169
Link Here
|
164 |
*/ |
164 |
*/ |
165 |
private MetadataModel metadataModel = null; |
165 |
private MetadataModel metadataModel = null; |
166 |
|
166 |
|
|
|
167 |
/** Properties for connection |
168 |
*/ |
169 |
private Properties connectionProperties = new Properties(); |
170 |
|
167 |
/** |
171 |
/** |
168 |
* The API DatabaseConnection (delegates to this instance) |
172 |
* The API DatabaseConnection (delegates to this instance) |
169 |
*/ |
173 |
*/ |
Lines 181-186
Link Here
|
181 |
public static final String PROP_DRIVERNAME = "drivername"; //NOI18N |
185 |
public static final String PROP_DRIVERNAME = "drivername"; //NOI18N |
182 |
public static final String PROP_NAME = "name"; //NOI18N |
186 |
public static final String PROP_NAME = "name"; //NOI18N |
183 |
public static final String PROP_DISPLAY_NAME = "displayName"; //NOI18N |
187 |
public static final String PROP_DISPLAY_NAME = "displayName"; //NOI18N |
|
|
188 |
public static final String PROP_CONNECTIONPROPERTIES = "connectionProperties"; |
184 |
public static final String DRIVER_CLASS_NET = "org.apache.derby.jdbc.ClientDriver"; // NOI18N |
189 |
public static final String DRIVER_CLASS_NET = "org.apache.derby.jdbc.ClientDriver"; // NOI18N |
185 |
public static final int DERBY_UNICODE_ERROR_CODE = 20000; |
190 |
public static final int DERBY_UNICODE_ERROR_CODE = 20000; |
186 |
private OpenConnectionInterface openConnection = null; |
191 |
private OpenConnectionInterface openConnection = null; |
Lines 217-238
Link Here
|
217 |
* @param password User password |
222 |
* @param password User password |
218 |
*/ |
223 |
*/ |
219 |
public DatabaseConnection(String driver, String database, String user, String password) { |
224 |
public DatabaseConnection(String driver, String database, String user, String password) { |
220 |
this(driver, null, database, null, user, password, null); |
225 |
this(driver, null, database, null, user, password, null, null); |
221 |
} |
226 |
} |
222 |
|
227 |
|
223 |
public DatabaseConnection(String driver, String driverName, String database, |
228 |
public DatabaseConnection(String driver, String driverName, String database, |
224 |
String theschema, String user, String password) { |
229 |
String theschema, String user, String password) { |
225 |
this(driver, driverName, database, theschema, user, password, null); |
230 |
this(driver, driverName, database, theschema, user, password, null, null); |
226 |
} |
231 |
} |
227 |
|
232 |
|
228 |
public DatabaseConnection(String driver, String driverName, String database, |
233 |
public DatabaseConnection(String driver, String driverName, String database, |
229 |
String theschema, String user) { |
234 |
String theschema, String user) { |
230 |
this(driver, driverName, database, theschema, user, null, null); |
235 |
this(driver, driverName, database, theschema, user, null, null, null); |
|
|
236 |
} |
237 |
|
238 |
public DatabaseConnection(String driver, String driverName, String database, |
239 |
String theschema, String user, Properties connectionProperties) { |
240 |
this(driver, driverName, database, theschema, user, null, null, connectionProperties); |
231 |
} |
241 |
} |
232 |
|
242 |
|
233 |
public DatabaseConnection(String driver, String driverName, String database, |
243 |
public DatabaseConnection(String driver, String driverName, String database, |
234 |
String theschema, String user, String password, |
244 |
String theschema, String user, String password, |
235 |
Boolean rememberPassword) { |
245 |
Boolean rememberPassword) { |
|
|
246 |
this( driver, driverName, database, theschema, user, password, |
247 |
rememberPassword, null); |
248 |
} |
249 |
|
250 |
public DatabaseConnection(String driver, String driverName, String database, |
251 |
String theschema, String user, String password, |
252 |
Boolean rememberPassword, Properties connectionProperties) { |
236 |
this(); |
253 |
this(); |
237 |
drv = driver; |
254 |
drv = driver; |
238 |
drvname = driverName; |
255 |
drvname = driverName; |
Lines 242-247
Link Here
|
242 |
rpwd = rememberPassword == null ? null : Boolean.valueOf(rememberPassword); |
259 |
rpwd = rememberPassword == null ? null : Boolean.valueOf(rememberPassword); |
243 |
schema = theschema; |
260 |
schema = theschema; |
244 |
name = getName(); |
261 |
name = getName(); |
|
|
262 |
setConnectionProperties(connectionProperties); |
245 |
} |
263 |
} |
246 |
|
264 |
|
247 |
public JDBCDriver findJDBCDriver() { |
265 |
public JDBCDriver findJDBCDriver() { |
Lines 511-516
Link Here
|
511 |
} |
529 |
} |
512 |
} |
530 |
} |
513 |
|
531 |
|
|
|
532 |
public Properties getConnectionProperties() { |
533 |
return (Properties) connectionProperties.clone(); |
534 |
} |
535 |
|
536 |
public void setConnectionProperties(Properties connectionProperties) { |
537 |
Properties old = this.connectionProperties; |
538 |
if(connectionProperties == null) { |
539 |
this.connectionProperties = new Properties(); |
540 |
} else { |
541 |
this.connectionProperties = (Properties) connectionProperties.clone(); |
542 |
} |
543 |
propertySupport.firePropertyChange(PROP_CONNECTIONPROPERTIES, old, connectionProperties); |
544 |
} |
545 |
|
514 |
/** Returns user schema name */ |
546 |
/** Returns user schema name */ |
515 |
@Override |
547 |
@Override |
516 |
public String getSchema() { |
548 |
public String getSchema() { |
Lines 672-680
Link Here
|
672 |
throw new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo")); // NOI18N |
704 |
throw new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo")); // NOI18N |
673 |
} |
705 |
} |
674 |
|
706 |
|
675 |
Properties dbprops = new Properties(); |
707 |
Properties dbprops = null; |
|
|
708 |
if(connectionProperties != null) { |
709 |
dbprops = getConnectionProperties(); |
710 |
} else { |
711 |
dbprops = new Properties(); |
712 |
} |
676 |
if ((usr != null) && (usr.length() > 0)) { |
713 |
if ((usr != null) && (usr.length() > 0)) { |
677 |
dbprops.put("user", usr); //NOI18N |
714 |
dbprops.put("user", usr); //NOI18N |
|
|
715 |
} |
716 |
if ((pwd != null) && (pwd.length() > 0)) { |
678 |
dbprops.put("password", pwd); //NOI18N |
717 |
dbprops.put("password", pwd); //NOI18N |
679 |
} |
718 |
} |
680 |
|
719 |
|
Lines 752-762
Link Here
|
752 |
sendException(new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo"))); |
791 |
sendException(new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo"))); |
753 |
} |
792 |
} |
754 |
|
793 |
|
755 |
Properties dbprops = new Properties(); |
794 |
Properties dbprops = null; |
756 |
if ( usr.length() > 0 ) { |
795 |
if(connectionProperties != null) { |
|
|
796 |
dbprops = getConnectionProperties(); |
797 |
} else { |
798 |
dbprops = new Properties(); |
799 |
} |
800 |
if ((usr != null) && (usr.length() > 0)) { |
757 |
dbprops.put("user", usr); //NOI18N |
801 |
dbprops.put("user", usr); //NOI18N |
758 |
} |
802 |
} |
759 |
if ((pwd != null && pwd.length() > 0)) { |
803 |
if ((pwd != null) && (pwd.length() > 0)) { |
760 |
dbprops.put("password", pwd); //NOI18N |
804 |
dbprops.put("password", pwd); //NOI18N |
761 |
} |
805 |
} |
762 |
|
806 |
|
Lines 945-953
Link Here
|
945 |
*/ |
989 |
*/ |
946 |
@Override |
990 |
@Override |
947 |
public boolean equals(Object obj) { |
991 |
public boolean equals(Object obj) { |
948 |
if (obj instanceof DBConnection) { |
992 |
if (obj instanceof DatabaseConnection) { |
949 |
DBConnection conn = (DBConnection) obj; |
993 |
DatabaseConnection conn = (DatabaseConnection) obj; |
950 |
return toString().equals(conn.toString()); |
994 |
return toString().equals(conn.toString()) && |
|
|
995 |
connectionProperties.equals(conn.getConnectionProperties()); |
951 |
} |
996 |
} |
952 |
|
997 |
|
953 |
return false; |
998 |
return false; |
Lines 969-974
Link Here
|
969 |
//IGNORE - drvname not stored in 3.6 and earlier |
1014 |
//IGNORE - drvname not stored in 3.6 and earlier |
970 |
//IGNORE - displayName not stored in 6.7 and earlier |
1015 |
//IGNORE - displayName not stored in 6.7 and earlier |
971 |
} |
1016 |
} |
|
|
1017 |
try { |
1018 |
connectionProperties = (Properties) in.readObject(); |
1019 |
} catch (Exception ex) { |
1020 |
//IGNORE - displayName not stored in 7.0 and earlier |
1021 |
} |
972 |
|
1022 |
|
973 |
// boston setting/pilsen setting? |
1023 |
// boston setting/pilsen setting? |
974 |
if ((name != null) && (name.equals(DatabaseConnection.SUPPORT))) { |
1024 |
if ((name != null) && (name.equals(DatabaseConnection.SUPPORT))) { |
Lines 992-997
Link Here
|
992 |
out.writeObject(DatabaseConnection.SUPPORT); |
1042 |
out.writeObject(DatabaseConnection.SUPPORT); |
993 |
out.writeObject(drvname); |
1043 |
out.writeObject(drvname); |
994 |
out.writeObject(displayName); |
1044 |
out.writeObject(displayName); |
|
|
1045 |
out.writeObject(connectionProperties); |
995 |
} |
1046 |
} |
996 |
|
1047 |
|
997 |
@Override |
1048 |
@Override |