Lines 156-161
Link Here
|
156 |
*/ |
156 |
*/ |
157 |
private MetadataModel metadataModel = null; |
157 |
private MetadataModel metadataModel = null; |
158 |
|
158 |
|
|
|
159 |
/** Properties for connection |
160 |
*/ |
161 |
private Properties connectionProperties = new Properties(); |
162 |
|
159 |
/** |
163 |
/** |
160 |
* The API DatabaseConnection (delegates to this instance) |
164 |
* The API DatabaseConnection (delegates to this instance) |
161 |
*/ |
165 |
*/ |
Lines 173-178
Link Here
|
173 |
public static final String PROP_DRIVERNAME = "drivername"; //NOI18N |
177 |
public static final String PROP_DRIVERNAME = "drivername"; //NOI18N |
174 |
public static final String PROP_NAME = "name"; //NOI18N |
178 |
public static final String PROP_NAME = "name"; //NOI18N |
175 |
public static final String PROP_DISPLAY_NAME = "displayName"; //NOI18N |
179 |
public static final String PROP_DISPLAY_NAME = "displayName"; //NOI18N |
|
|
180 |
public static final String PROP_CONNECTIONPROPERTIES = "connectionProperties"; |
176 |
public static final String DRIVER_CLASS_NET = "org.apache.derby.jdbc.ClientDriver"; // NOI18N |
181 |
public static final String DRIVER_CLASS_NET = "org.apache.derby.jdbc.ClientDriver"; // NOI18N |
177 |
public static final int DERBY_UNICODE_ERROR_CODE = 20000; |
182 |
public static final int DERBY_UNICODE_ERROR_CODE = 20000; |
178 |
private OpenConnectionInterface openConnection = null; |
183 |
private OpenConnectionInterface openConnection = null; |
Lines 210-231
Link Here
|
210 |
* @param password User password |
215 |
* @param password User password |
211 |
*/ |
216 |
*/ |
212 |
public DatabaseConnection(String driver, String database, String user, String password) { |
217 |
public DatabaseConnection(String driver, String database, String user, String password) { |
213 |
this(driver, null, database, null, user, password, null); |
218 |
this(driver, null, database, null, user, password, null, null); |
214 |
} |
219 |
} |
215 |
|
220 |
|
216 |
public DatabaseConnection(String driver, String driverName, String database, |
221 |
public DatabaseConnection(String driver, String driverName, String database, |
217 |
String theschema, String user, String password) { |
222 |
String theschema, String user, String password) { |
218 |
this(driver, driverName, database, theschema, user, password, null); |
223 |
this(driver, driverName, database, theschema, user, password, null, null); |
219 |
} |
224 |
} |
220 |
|
225 |
|
221 |
public DatabaseConnection(String driver, String driverName, String database, |
226 |
public DatabaseConnection(String driver, String driverName, String database, |
222 |
String theschema, String user) { |
227 |
String theschema, String user) { |
223 |
this(driver, driverName, database, theschema, user, null, null); |
228 |
this(driver, driverName, database, theschema, user, null, null, null); |
|
|
229 |
} |
230 |
|
231 |
public DatabaseConnection(String driver, String driverName, String database, |
232 |
String theschema, String user, Properties connectionProperties) { |
233 |
this(driver, driverName, database, theschema, user, null, null, connectionProperties); |
224 |
} |
234 |
} |
225 |
|
235 |
|
226 |
public DatabaseConnection(String driver, String driverName, String database, |
236 |
public DatabaseConnection(String driver, String driverName, String database, |
227 |
String theschema, String user, String password, |
237 |
String theschema, String user, String password, |
228 |
Boolean rememberPassword) { |
238 |
Boolean rememberPassword) { |
|
|
239 |
this(driver, driverName, database, theschema, user, password, |
240 |
rememberPassword, null); |
241 |
} |
242 |
|
243 |
public DatabaseConnection(String driver, String driverName, String database, |
244 |
String theschema, String user, String password, |
245 |
Boolean rememberPassword, Properties connectionProperties) { |
229 |
this(); |
246 |
this(); |
230 |
drv = driver; |
247 |
drv = driver; |
231 |
drvname = driverName; |
248 |
drvname = driverName; |
Lines 235-240
Link Here
|
235 |
rpwd = rememberPassword == null ? null : Boolean.valueOf(rememberPassword); |
252 |
rpwd = rememberPassword == null ? null : Boolean.valueOf(rememberPassword); |
236 |
schema = theschema; |
253 |
schema = theschema; |
237 |
name = getName(); |
254 |
name = getName(); |
|
|
255 |
setConnectionProperties(connectionProperties); |
238 |
} |
256 |
} |
239 |
|
257 |
|
240 |
public JDBCDriver findJDBCDriver() { |
258 |
public JDBCDriver findJDBCDriver() { |
Lines 548-553
Link Here
|
548 |
} |
566 |
} |
549 |
} |
567 |
} |
550 |
|
568 |
|
|
|
569 |
@Override |
570 |
public Properties getConnectionProperties() { |
571 |
return (Properties) connectionProperties.clone(); |
572 |
} |
573 |
|
574 |
@Override |
575 |
public void setConnectionProperties(Properties connectionProperties) { |
576 |
Properties old = this.connectionProperties; |
577 |
if (connectionProperties == null) { |
578 |
this.connectionProperties = new Properties(); |
579 |
} else { |
580 |
this.connectionProperties = (Properties) connectionProperties.clone(); |
581 |
} |
582 |
propertySupport.firePropertyChange(PROP_CONNECTIONPROPERTIES, old, connectionProperties); |
583 |
} |
584 |
|
551 |
/** Returns user schema name */ |
585 |
/** Returns user schema name */ |
552 |
@Override |
586 |
@Override |
553 |
public String getSchema() { |
587 |
public String getSchema() { |
Lines 732-740
Link Here
|
732 |
throw new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo")); // NOI18N |
766 |
throw new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo")); // NOI18N |
733 |
} |
767 |
} |
734 |
|
768 |
|
735 |
Properties dbprops = new Properties(); |
769 |
Properties dbprops; |
|
|
770 |
if (connectionProperties != null) { |
771 |
dbprops = getConnectionProperties(); |
772 |
} else { |
773 |
dbprops = new Properties(); |
774 |
} |
736 |
if ((usr != null) && (usr.length() > 0)) { |
775 |
if ((usr != null) && (usr.length() > 0)) { |
737 |
dbprops.put("user", usr); //NOI18N |
776 |
dbprops.put("user", usr); //NOI18N |
|
|
777 |
} |
778 |
if ((pwd != null) && (pwd.length() > 0)) { |
738 |
dbprops.put("password", pwd); //NOI18N |
779 |
dbprops.put("password", pwd); //NOI18N |
739 |
} |
780 |
} |
740 |
|
781 |
|
Lines 812-822
Link Here
|
812 |
sendException(new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo"))); |
853 |
sendException(new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo"))); |
813 |
} |
854 |
} |
814 |
|
855 |
|
815 |
Properties dbprops = new Properties(); |
856 |
Properties dbprops; |
816 |
if ( usr.length() > 0 ) { |
857 |
if (connectionProperties != null) { |
|
|
858 |
dbprops = getConnectionProperties(); |
859 |
} else { |
860 |
dbprops = new Properties(); |
861 |
} |
862 |
if ((usr != null) && (usr.length() > 0)) { |
817 |
dbprops.put("user", usr); //NOI18N |
863 |
dbprops.put("user", usr); //NOI18N |
818 |
} |
864 |
} |
819 |
if ((pwd != null && pwd.length() > 0)) { |
865 |
if ((pwd != null) && (pwd.length() > 0)) { |
820 |
dbprops.put("password", pwd); //NOI18N |
866 |
dbprops.put("password", pwd); //NOI18N |
821 |
} |
867 |
} |
822 |
|
868 |
|
Lines 1005-1013
Link Here
|
1005 |
*/ |
1051 |
*/ |
1006 |
@Override |
1052 |
@Override |
1007 |
public boolean equals(Object obj) { |
1053 |
public boolean equals(Object obj) { |
1008 |
if (obj instanceof DBConnection) { |
1054 |
if (obj instanceof DatabaseConnection) { |
1009 |
DBConnection conn = (DBConnection) obj; |
1055 |
DatabaseConnection conn = (DatabaseConnection) obj; |
1010 |
return toString().equals(conn.toString()); |
1056 |
if (toString().equals(conn.toString())) { |
|
|
1057 |
if ((connectionProperties == null |
1058 |
&& conn.getConnectionProperties() == null)) { |
1059 |
return true; |
1060 |
} else if (connectionProperties != null) { |
1061 |
return connectionProperties.equals( |
1062 |
conn.getConnectionProperties()); |
1063 |
} |
1064 |
} |
1011 |
} |
1065 |
} |
1012 |
|
1066 |
|
1013 |
return false; |
1067 |
return false; |
Lines 1029-1034
Link Here
|
1029 |
//IGNORE - drvname not stored in 3.6 and earlier |
1083 |
//IGNORE - drvname not stored in 3.6 and earlier |
1030 |
//IGNORE - displayName not stored in 6.7 and earlier |
1084 |
//IGNORE - displayName not stored in 6.7 and earlier |
1031 |
} |
1085 |
} |
|
|
1086 |
try { |
1087 |
connectionProperties = (Properties) in.readObject(); |
1088 |
} catch (Exception ex) { |
1089 |
//IGNORE - connectionProperties not stored in 7.3 and earlier |
1090 |
} |
1032 |
|
1091 |
|
1033 |
// boston setting/pilsen setting? |
1092 |
// boston setting/pilsen setting? |
1034 |
if ((name != null) && (name.equals(DatabaseConnection.SUPPORT))) { |
1093 |
if ((name != null) && (name.equals(DatabaseConnection.SUPPORT))) { |
Lines 1052-1057
Link Here
|
1052 |
out.writeObject(DatabaseConnection.SUPPORT); |
1111 |
out.writeObject(DatabaseConnection.SUPPORT); |
1053 |
out.writeObject(drvname); |
1112 |
out.writeObject(drvname); |
1054 |
out.writeObject(displayName); |
1113 |
out.writeObject(displayName); |
|
|
1114 |
out.writeObject(connectionProperties); |
1055 |
} |
1115 |
} |
1056 |
|
1116 |
|
1057 |
@Override |
1117 |
@Override |