Lines 174-179
Link Here
|
174 |
*/ |
174 |
*/ |
175 |
private MetadataModel metadataModel = null; |
175 |
private MetadataModel metadataModel = null; |
176 |
|
176 |
|
|
|
177 |
/** Properties for connection |
178 |
*/ |
179 |
private Properties connectionProperties = new Properties(); |
180 |
|
177 |
/** |
181 |
/** |
178 |
* The API DatabaseConnection (delegates to this instance) |
182 |
* The API DatabaseConnection (delegates to this instance) |
179 |
*/ |
183 |
*/ |
Lines 191-196
Link Here
|
191 |
public static final String PROP_DRIVERNAME = "drivername"; //NOI18N |
195 |
public static final String PROP_DRIVERNAME = "drivername"; //NOI18N |
192 |
public static final String PROP_NAME = "name"; //NOI18N |
196 |
public static final String PROP_NAME = "name"; //NOI18N |
193 |
public static final String PROP_DISPLAY_NAME = "displayName"; //NOI18N |
197 |
public static final String PROP_DISPLAY_NAME = "displayName"; //NOI18N |
|
|
198 |
public static final String PROP_CONNECTIONPROPERTIES = "connectionProperties"; |
194 |
public static final String DRIVER_CLASS_NET = "org.apache.derby.jdbc.ClientDriver"; // NOI18N |
199 |
public static final String DRIVER_CLASS_NET = "org.apache.derby.jdbc.ClientDriver"; // NOI18N |
195 |
public static final int DERBY_UNICODE_ERROR_CODE = 20000; |
200 |
public static final int DERBY_UNICODE_ERROR_CODE = 20000; |
196 |
private OpenConnectionInterface openConnection = null; |
201 |
private OpenConnectionInterface openConnection = null; |
Lines 227-248
Link Here
|
227 |
* @param password User password |
232 |
* @param password User password |
228 |
*/ |
233 |
*/ |
229 |
public DatabaseConnection(String driver, String database, String user, String password) { |
234 |
public DatabaseConnection(String driver, String database, String user, String password) { |
230 |
this(driver, null, database, null, user, password, null); |
235 |
this(driver, null, database, null, user, password, null, null); |
231 |
} |
236 |
} |
232 |
|
237 |
|
233 |
public DatabaseConnection(String driver, String driverName, String database, |
238 |
public DatabaseConnection(String driver, String driverName, String database, |
234 |
String theschema, String user, String password) { |
239 |
String theschema, String user, String password) { |
235 |
this(driver, driverName, database, theschema, user, password, null); |
240 |
this(driver, driverName, database, theschema, user, password, null, null); |
236 |
} |
241 |
} |
237 |
|
242 |
|
238 |
public DatabaseConnection(String driver, String driverName, String database, |
243 |
public DatabaseConnection(String driver, String driverName, String database, |
239 |
String theschema, String user) { |
244 |
String theschema, String user) { |
240 |
this(driver, driverName, database, theschema, user, null, null); |
245 |
this(driver, driverName, database, theschema, user, null, null, null); |
241 |
} |
246 |
} |
242 |
|
247 |
|
243 |
public DatabaseConnection(String driver, String driverName, String database, |
248 |
public DatabaseConnection(String driver, String driverName, String database, |
|
|
249 |
String theschema, String user, Properties connectionProperties) { |
250 |
this(driver, driverName, database, theschema, user, null, null, connectionProperties); |
251 |
} |
252 |
|
253 |
public DatabaseConnection(String driver, String driverName, String database, |
244 |
String theschema, String user, String password, |
254 |
String theschema, String user, String password, |
245 |
Boolean rememberPassword) { |
255 |
Boolean rememberPassword) { |
|
|
256 |
this( driver, driverName, database, theschema, user, password, |
257 |
rememberPassword, null); |
258 |
} |
259 |
|
260 |
public DatabaseConnection(String driver, String driverName, String database, |
261 |
String theschema, String user, String password, |
262 |
Boolean rememberPassword, Properties connectionProperties) { |
246 |
this(); |
263 |
this(); |
247 |
drv = driver; |
264 |
drv = driver; |
248 |
drvname = driverName; |
265 |
drvname = driverName; |
Lines 252-257
Link Here
|
252 |
rpwd = rememberPassword == null ? null : Boolean.valueOf(rememberPassword); |
269 |
rpwd = rememberPassword == null ? null : Boolean.valueOf(rememberPassword); |
253 |
schema = theschema; |
270 |
schema = theschema; |
254 |
name = getName(); |
271 |
name = getName(); |
|
|
272 |
setConnectionProperties(connectionProperties); |
255 |
} |
273 |
} |
256 |
|
274 |
|
257 |
public JDBCDriver findJDBCDriver() { |
275 |
public JDBCDriver findJDBCDriver() { |
Lines 521-526
Link Here
|
521 |
} |
539 |
} |
522 |
} |
540 |
} |
523 |
|
541 |
|
|
|
542 |
public Properties getConnectionProperties() { |
543 |
return (Properties) connectionProperties.clone(); |
544 |
} |
545 |
|
546 |
public void setConnectionProperties(Properties connectionProperties) { |
547 |
Properties old = this.connectionProperties; |
548 |
if(connectionProperties == null) { |
549 |
this.connectionProperties = new Properties(); |
550 |
} else { |
551 |
this.connectionProperties = (Properties) connectionProperties.clone(); |
552 |
} |
553 |
propertySupport.firePropertyChange(PROP_CONNECTIONPROPERTIES, old, connectionProperties); |
554 |
} |
555 |
|
524 |
/** Returns user schema name */ |
556 |
/** Returns user schema name */ |
525 |
@Override |
557 |
@Override |
526 |
public String getSchema() { |
558 |
public String getSchema() { |
Lines 784-792
Link Here
|
784 |
throw new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo")); // NOI18N |
816 |
throw new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo")); // NOI18N |
785 |
} |
817 |
} |
786 |
|
818 |
|
787 |
Properties dbprops = new Properties(); |
819 |
Properties dbprops = null; |
|
|
820 |
if(connectionProperties != null) { |
821 |
dbprops = getConnectionProperties(); |
822 |
} else { |
823 |
dbprops = new Properties(); |
824 |
} |
788 |
if ((usr != null) && (usr.length() > 0)) { |
825 |
if ((usr != null) && (usr.length() > 0)) { |
789 |
dbprops.put("user", usr); //NOI18N |
826 |
dbprops.put("user", usr); //NOI18N |
|
|
827 |
} |
828 |
if ((pwd != null) && (pwd.length() > 0)) { |
790 |
dbprops.put("password", pwd); //NOI18N |
829 |
dbprops.put("password", pwd); //NOI18N |
791 |
} |
830 |
} |
792 |
|
831 |
|
Lines 864-874
Link Here
|
864 |
sendException(new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo"))); |
903 |
sendException(new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo"))); |
865 |
} |
904 |
} |
866 |
|
905 |
|
867 |
Properties dbprops = new Properties(); |
906 |
Properties dbprops = null; |
868 |
if ( usr.length() > 0 ) { |
907 |
if(connectionProperties != null) { |
|
|
908 |
dbprops = getConnectionProperties(); |
909 |
} else { |
910 |
dbprops = new Properties(); |
911 |
} |
912 |
if ((usr != null) && (usr.length() > 0)) { |
869 |
dbprops.put("user", usr); //NOI18N |
913 |
dbprops.put("user", usr); //NOI18N |
870 |
} |
914 |
} |
871 |
if ((pwd != null && pwd.length() > 0)) { |
915 |
if ((pwd != null) && (pwd.length() > 0)) { |
872 |
dbprops.put("password", pwd); //NOI18N |
916 |
dbprops.put("password", pwd); //NOI18N |
873 |
} |
917 |
} |
874 |
|
918 |
|
Lines 1057-1065
Link Here
|
1057 |
*/ |
1101 |
*/ |
1058 |
@Override |
1102 |
@Override |
1059 |
public boolean equals(Object obj) { |
1103 |
public boolean equals(Object obj) { |
1060 |
if (obj instanceof DBConnection) { |
1104 |
if (obj instanceof DatabaseConnection) { |
1061 |
DBConnection conn = (DBConnection) obj; |
1105 |
DatabaseConnection conn = (DatabaseConnection) obj; |
1062 |
return toString().equals(conn.toString()); |
1106 |
return toString().equals(conn.toString()) && |
|
|
1107 |
connectionProperties.equals(conn.getConnectionProperties()); |
1063 |
} |
1108 |
} |
1064 |
|
1109 |
|
1065 |
return false; |
1110 |
return false; |
Lines 1081-1086
Link Here
|
1081 |
//IGNORE - drvname not stored in 3.6 and earlier |
1126 |
//IGNORE - drvname not stored in 3.6 and earlier |
1082 |
//IGNORE - displayName not stored in 6.7 and earlier |
1127 |
//IGNORE - displayName not stored in 6.7 and earlier |
1083 |
} |
1128 |
} |
|
|
1129 |
try { |
1130 |
connectionProperties = (Properties) in.readObject(); |
1131 |
} catch (Exception ex) { |
1132 |
//IGNORE - connectionProperties not stored in 7.0 and earlier |
1133 |
} |
1084 |
|
1134 |
|
1085 |
// boston setting/pilsen setting? |
1135 |
// boston setting/pilsen setting? |
1086 |
if ((name != null) && (name.equals(DatabaseConnection.SUPPORT))) { |
1136 |
if ((name != null) && (name.equals(DatabaseConnection.SUPPORT))) { |
Lines 1104-1109
Link Here
|
1104 |
out.writeObject(DatabaseConnection.SUPPORT); |
1154 |
out.writeObject(DatabaseConnection.SUPPORT); |
1105 |
out.writeObject(drvname); |
1155 |
out.writeObject(drvname); |
1106 |
out.writeObject(displayName); |
1156 |
out.writeObject(displayName); |
|
|
1157 |
out.writeObject(connectionProperties); |
1107 |
} |
1158 |
} |
1108 |
|
1159 |
|
1109 |
@Override |
1160 |
@Override |