@@ -163,6 +163,7 @@ private static void fillTableAndColumnNames(DatabaseMetaData meta, String schema
163163 try {
164164 while (cols .next ()) {
165165 String schema = cols .getString ("TABLE_SCHEM" );
166+ if (schema == null ) schema = cols .getString ("TABLE_CAT" );
166167 String table = cols .getString ("TABLE_NAME" );
167168 String column = cols .getString ("COLUMN_NAME" );
168169 if (!isBlank (table )) {
@@ -197,14 +198,17 @@ public static Set<String> getSqlKeywordsCompletions(Connection connection) throw
197198 // Add the driver specific SQL completions
198199 String driverSpecificKeywords =
199200 "/" + metaData .getDriverName ().replace (" " , "-" ).toLowerCase () + "-sql.keywords" ;
200-
201201 logger .info ("JDBC DriverName:" + driverSpecificKeywords );
202-
203- if (SqlCompleter .class .getResource (driverSpecificKeywords ) != null ) {
204- String driverKeywords =
205- new BufferedReader (new InputStreamReader (
206- SqlCompleter .class .getResourceAsStream (driverSpecificKeywords ))).readLine ();
207- keywords += "," + driverKeywords .toUpperCase ();
202+ try {
203+ if (SqlCompleter .class .getResource (driverSpecificKeywords ) != null ) {
204+ String driverKeywords =
205+ new BufferedReader (new InputStreamReader (
206+ SqlCompleter .class .getResourceAsStream (driverSpecificKeywords ))).readLine ();
207+ keywords += "," + driverKeywords .toUpperCase ();
208+ }
209+ } catch (Exception e ) {
210+ logger .debug ("fail to get driver specific SQL completions for " +
211+ driverSpecificKeywords + " : " + e , e );
208212 }
209213
210214
@@ -317,6 +321,7 @@ public void initFromConnection(Connection connection, String schemaFilter) {
317321 Set <String > keywords = getSqlKeywordsCompletions (connection );
318322 if (connection != null ) {
319323 schemas = getSchemaNames (connection .getMetaData (), schemaFilter );
324+ if (schemas .size () == 0 ) schemas .add (connection .getCatalog ());
320325 fillTableAndColumnNames (connection .getMetaData (), schemaFilter , tables , columns );
321326 }
322327 init (schemas , tables , columns , keywords );
0 commit comments