Lines 91-130
Link Here
|
91 |
if (catalog == null || dmd == null) { |
91 |
if (catalog == null || dmd == null) { |
92 |
this.catalog = catalog; |
92 |
this.catalog = catalog; |
93 |
return; |
93 |
return; |
94 |
} else |
94 |
} else { |
95 |
catalog.trim(); |
95 |
catalog = catalog.trim(); |
|
|
96 |
} |
96 |
|
97 |
|
97 |
ResultSet result; |
98 |
ResultSet result = null; |
98 |
List<String> list = new LinkedList<String>(); |
99 |
List<String> list = new LinkedList<String>(); |
99 |
|
100 |
|
100 |
try { |
101 |
try { |
101 |
result = dmd.getCatalogs(); |
102 |
result = dmd.getCatalogs(); |
102 |
while (result.next()) |
103 |
while (result.next()) { |
103 |
list.add(result.getString(1).trim()); |
104 |
String candidate = result.getString(1); |
|
|
105 |
if(candidate != null) { |
106 |
list.add(candidate.trim()); |
107 |
} |
108 |
} |
104 |
result.close(); |
109 |
result.close(); |
105 |
} catch (SQLException exc) { |
110 |
} catch (SQLException exc) { |
106 |
Logger.getLogger("global").log(Level.INFO, null, exc); |
111 |
Logger.getLogger("global").log(Level.INFO, null, exc); |
107 |
|
|
|
108 |
// this.catalog = catalog; |
109 |
this.catalog = null; //hack for IBM ODBC driver |
112 |
this.catalog = null; //hack for IBM ODBC driver |
110 |
result = null; |
|
|
111 |
return; |
113 |
return; |
|
|
114 |
} finally { |
115 |
try { |
116 |
if(result != null) { |
117 |
result.close(); |
112 |
} |
118 |
} |
|
|
119 |
} catch (Exception ex) {} |
120 |
} |
113 |
|
121 |
|
114 |
if (list.contains(catalog)) |
122 |
if (list.contains(catalog)) { |
115 |
this.catalog = catalog; |
123 |
this.catalog = catalog; |
116 |
else |
124 |
} else { |
117 |
this.catalog = null; //hack for Sybase ODBC driver |
125 |
this.catalog = null; //hack for Sybase ODBC driver |
118 |
} |
126 |
} |
|
|
127 |
} |
119 |
|
128 |
|
120 |
public String getCatalog() { |
129 |
public String getCatalog() { |
121 |
return catalog; |
130 |
return catalog; |
122 |
} |
131 |
} |
123 |
|
132 |
|
124 |
public void setSchema(String schema) { |
133 |
public void setSchema(String schema) { |
|
|
134 |
if (schema == null || dmd == null) { |
125 |
this.schema = schema; |
135 |
this.schema = schema; |
|
|
136 |
return; |
137 |
} else { |
138 |
schema = schema.trim(); |
126 |
} |
139 |
} |
127 |
|
140 |
|
|
|
141 |
ResultSet result = null; |
142 |
List<String> list = new LinkedList<String>(); |
143 |
|
144 |
try { |
145 |
result = dmd.getSchemas(); |
146 |
while (result.next()) { |
147 |
String candidate = result.getString(1); |
148 |
if(candidate != null) { |
149 |
list.add(candidate.trim()); |
150 |
} |
151 |
} |
152 |
} catch (SQLException exc) { |
153 |
Logger.getLogger("global").log(Level.INFO, null, exc); |
154 |
this.schema = null; //hack for Access ODBC driver |
155 |
return; |
156 |
} finally { |
157 |
try { |
158 |
if(result != null) { |
159 |
result.close(); |
160 |
} |
161 |
} catch (Exception ex) {} |
162 |
} |
163 |
|
164 |
if (list.contains(schema)) { |
165 |
this.schema = schema; |
166 |
} else { |
167 |
this.schema = null; //hack for Sybase ODBC driver |
168 |
} |
169 |
} |
170 |
|
128 |
public String getSchema() { |
171 |
public String getSchema() { |
129 |
return schema; |
172 |
return schema; |
130 |
} |
173 |
} |