This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 231030
Collapse All | Expand All

(-)a/db.dataview/nbproject/project.xml (-1 / +1 lines)
Lines 29-35 Link Here
29
                    <compile-dependency/>
29
                    <compile-dependency/>
30
                    <run-dependency>
30
                    <run-dependency>
31
                        <release-version>1</release-version>
31
                        <release-version>1</release-version>
32
                        <specification-version>1.25.0.5</specification-version>
32
                        <specification-version>1.56</specification-version>
33
                    </run-dependency>
33
                    </run-dependency>
34
                </dependency>
34
                </dependency>
35
                <dependency>
35
                <dependency>
(-)a/db.dataview/src/org/netbeans/modules/db/dataview/output/SQLExecutionHelper.java (-30 / +1 lines)
Lines 1084-1090 Link Here
1084
     */
1084
     */
1085
    private void updateScrollableSupport(Connection conn, DatabaseConnection dc,
1085
    private void updateScrollableSupport(Connection conn, DatabaseConnection dc,
1086
            String sql) {
1086
            String sql) {
1087
        useScrollableCursors = checkDriverSupportsScrollableCursors(dc);
1087
        useScrollableCursors = dc.isUseScrollableCursors();
1088
        if (!useScrollableCursors) {
1088
        if (!useScrollableCursors) {
1089
            return;
1089
            return;
1090
        }
1090
        }
Lines 1113-1145 Link Here
1113
                    + " database for scrollable resultset support"); //NOI18N
1113
                    + " database for scrollable resultset support"); //NOI18N
1114
        }
1114
        }
1115
    }
1115
    }
1116
1117
    /**
1118
     * Decide whether scrollable cursors should be used by the connection.
1119
     */
1120
    private boolean checkDriverSupportsScrollableCursors(DatabaseConnection dc) {
1121
        String drv = dc == null ? null : dc.getDriverClass();
1122
        if (drv == null) {
1123
            return false;
1124
        } else {
1125
            String customPattern = System.getProperty(
1126
                    "db.scrollable.cursors.drivers");                    //NOI18N
1127
            if (customPattern != null) {
1128
                LOGGER.log(Level.INFO,
1129
                        "Using custom pattern for scrollable cursors: {0}", //NOI18N
1130
                        customPattern);
1131
                try {
1132
                    return drv.matches(customPattern);
1133
                } catch (Exception e) {
1134
                    LOGGER.log(Level.INFO, "Invalid pattern", e);       //NOI18N
1135
                }
1136
            }
1137
            LOGGER.log(Level.FINE, "Using built-in list of drivers " //NOI18N
1138
                    + " with support for scrollable cursors.");      //NOI18N
1139
            return drv.startsWith("org.apache.derby") //NOI18N
1140
                    || drv.startsWith("com.mysql") //NOI18N
1141
                    || drv.startsWith("oracle") //NOI18N
1142
                    || drv.startsWith("org.postgresql"); //NOI18N
1143
        }
1144
    }
1145
}
1116
}
(-)a/db/apichanges.xml (+17 lines)
Lines 109-114 Link Here
109
109
110
    <changes>
110
    <changes>
111
        <change>
111
        <change>
112
            <api name="configure_scrollable_cursors"/>
113
            <summary>
114
                Configure usage of scrollable cursors.
115
            </summary>
116
            <version major="1" minor="56"/>
117
            <date day="10" month="6" year="2013"/>
118
            <author login="jhavlin"/>
119
            <compatibility addition="yes"/>
120
            <description>
121
                Users can enable or disable using of scrollable cursors, which
122
                can make queries faster, but also can cause problems for some
123
                drivers.
124
            </description>
125
            <class package="org.netbeans.api.db.explorer" name="DatabaseConnection"/>
126
            <issue number="231030"/>
127
        </change>
128
        <change>
112
            <api name="database_explorer_api"/>
129
            <api name="database_explorer_api"/>
113
            <summary>
130
            <summary>
114
                Enable editting of connection properties for db connections
131
                Enable editting of connection properties for db connections
(-)a/db/nbproject/project.properties (-1 / +1 lines)
Lines 45-51 Link Here
45
javadoc.arch=${basedir}/arch.xml
45
javadoc.arch=${basedir}/arch.xml
46
javadoc.apichanges=${basedir}/apichanges.xml
46
javadoc.apichanges=${basedir}/apichanges.xml
47
47
48
spec.version.base=1.55.0
48
spec.version.base=1.56
49
49
50
extra.module.files=modules/ext/ddl.jar
50
extra.module.files=modules/ext/ddl.jar
51
51
(-)a/db/src/org/netbeans/api/db/explorer/DatabaseConnection.java (+26 lines)
Lines 287-292 Link Here
287
    }
287
    }
288
288
289
    /**
289
    /**
290
     * Check whether usage of scrollable cursors is recommended for this
291
     * connection.
292
     *
293
     * @return True if scrollable cursors can be used, false if scrollable
294
     * cursors are not supported by driver or database of this connection.
295
     *
296
     * @since db/1.56
297
     */
298
    public boolean isUseScrollableCursors() {
299
        return delegate.isUseScrollableCursors();
300
    }
301
302
    /**
303
     * Set whether usage of scrollable cursors is recommended for this
304
     * connection.
305
     *
306
     * @param useScrollableCursors True if this connection is allowed to use
307
     * scrollable cursors, false otherwise (older JDBC methods will be used
308
     * instead.).
309
     * @since db/1.56
310
     */
311
    public void setUseScrollableCursors(boolean useScrollableCursors) {
312
        delegate.setUseScrollableCursors(useScrollableCursors);
313
    }
314
315
    /**
290
     * Returns the {@link java.sql.Connection} instance which encapsulates 
316
     * Returns the {@link java.sql.Connection} instance which encapsulates 
291
     * the physical connection to the database if this database connection
317
     * the physical connection to the database if this database connection
292
     * is connected. Note that "connected" here means "connected using the
318
     * is connected. Note that "connected" here means "connected using the
(-)a/db/src/org/netbeans/api/db/explorer/node/Bundle.properties (+2 lines)
Lines 148-153 Link Here
148
ConnectionPropertiesDescription=Connection properties
148
ConnectionPropertiesDescription=Connection properties
149
SeparateSystemTables=Show system tables separately
149
SeparateSystemTables=Show system tables separately
150
SeparateSystemTablesDescription=Use special node for system tables
150
SeparateSystemTablesDescription=Use special node for system tables
151
UseScrollableCursors=Use scrollable cursors
152
UseScrollableCursorsDescription=Use JDBC support for scrollable cursors. This makes the execution faster, but some drivers can become unstable.
151
153
152
# Booleans
154
# Booleans
153
155
(-)a/db/src/org/netbeans/modules/db/explorer/DatabaseConnection.java (+25 lines)
Lines 166-171 Link Here
166
166
167
    private volatile boolean separateSystemTables = false;
167
    private volatile boolean separateSystemTables = false;
168
168
169
    private Boolean useScrollableCursors = null; // null = driver default
170
169
    /**
171
    /**
170
     * The API DatabaseConnection (delegates to this instance)
172
     * The API DatabaseConnection (delegates to this instance)
171
     */
173
     */
Lines 1347-1350 Link Here
1347
        this.separateSystemTables = separateSystemTables;
1349
        this.separateSystemTables = separateSystemTables;
1348
        propertySupport.firePropertyChange("separateSystemTables", oldVal, separateSystemTables); //NOI18N
1350
        propertySupport.firePropertyChange("separateSystemTables", oldVal, separateSystemTables); //NOI18N
1349
    }
1351
    }
1352
1353
    /**
1354
     * Decide whether scrollable cursors should be used by the connection.
1355
     */
1356
    private boolean isUseScrollableCursorsByDefault() {
1357
        return drv != null
1358
                && (drv.startsWith("org.apache.derby") //NOI18N
1359
                || drv.startsWith("com.mysql") //NOI18N
1360
                || drv.startsWith("oracle") //NOI18N
1361
                || drv.startsWith("org.postgresql")); //NOI18N
1362
    }
1363
1364
    public boolean isUseScrollableCursors() {
1365
        return useScrollableCursors == null
1366
                ? isUseScrollableCursorsByDefault()
1367
                : useScrollableCursors;
1368
    }
1369
1370
    public void setUseScrollableCursors(boolean useScrollableCursors) {
1371
        boolean oldVal = isUseScrollableCursors();
1372
        this.useScrollableCursors = useScrollableCursors;
1373
        propertySupport.firePropertyChange("useScrollableCursors", oldVal, useScrollableCursors); //NOI18N
1374
    }
1350
}
1375
}
(-)a/db/src/org/netbeans/modules/db/explorer/DatabaseConnectionConvertor.java (-1 / +9 lines)
Lines 253-258 Link Here
253
            dbconn.addImportantCatalog(importantDatabase);
253
            dbconn.addImportantCatalog(importantDatabase);
254
        }
254
        }
255
        dbconn.setSeparateSystemTables(handler.separateSystemTables);
255
        dbconn.setSeparateSystemTables(handler.separateSystemTables);
256
        if (handler.useScrollableCursors != null) {
257
            dbconn.setUseScrollableCursors(handler.useScrollableCursors);
258
        }
256
        LOGGER.fine("Created DatabaseConnection[" + dbconn.toString() + "] from file: " + handler.connectionFileName);
259
        LOGGER.fine("Created DatabaseConnection[" + dbconn.toString() + "] from file: " + handler.connectionFileName);
257
260
258
        return dbconn;
261
        return dbconn;
Lines 392-398 Link Here
392
395
393
        void write(PrintWriter pw, String name) throws IOException {
396
        void write(PrintWriter pw, String name) throws IOException {
394
            pw.println("<?xml version='1.0'?>"); //NOI18N
397
            pw.println("<?xml version='1.0'?>"); //NOI18N
395
            pw.println("<!DOCTYPE connection PUBLIC '-//NetBeans//DTD Database Connection 1.1//EN' 'http://www.netbeans.org/dtds/connection-1_1.dtd'>"); //NOI18N
398
            pw.println("<!DOCTYPE connection PUBLIC '-//NetBeans//DTD Database Connection 1.2//EN' 'http://www.netbeans.org/dtds/connection-1_2.dtd'>"); //NOI18N
396
            pw.println("<connection>"); //NOI18N
399
            pw.println("<connection>"); //NOI18N
397
            pw.println("  <driver-class value='" + XMLUtil.toAttributeValue(instance.getDriver()) + "'/>"); //NOI18N
400
            pw.println("  <driver-class value='" + XMLUtil.toAttributeValue(instance.getDriver()) + "'/>"); //NOI18N
398
            pw.println("  <driver-name value='" + XMLUtil.toAttributeValue(instance.getDriverName()) + "'/>"); // NOI18N
401
            pw.println("  <driver-name value='" + XMLUtil.toAttributeValue(instance.getDriverName()) + "'/>"); // NOI18N
Lines 435-440 Link Here
435
            if (instance.isSeparateSystemTables()) {
438
            if (instance.isSeparateSystemTables()) {
436
                pw.println("  <separate-system-tables value='true'/>"); //NOI18N
439
                pw.println("  <separate-system-tables value='true'/>"); //NOI18N
437
            }
440
            }
441
            pw.println("  <use-scrollable-cursors value='" + instance.isUseScrollableCursors() + "'/>"); //NOI18N
438
            pw.println("</connection>"); //NOI18N
442
            pw.println("</connection>"); //NOI18N
439
        }        
443
        }        
440
    }
444
    }
Lines 455-460 Link Here
455
        private static final String ELEMENT_IMPORTANT_CATALOG = "important-catalog"; //NOI18N
459
        private static final String ELEMENT_IMPORTANT_CATALOG = "important-catalog"; //NOI18N
456
        private static final String ELEMENT_CONNECTION_PROPERTY = "connection-property"; // NOI18N
460
        private static final String ELEMENT_CONNECTION_PROPERTY = "connection-property"; // NOI18N
457
        private static final String ELEMENT_SEPARATE_SYS_TABLES = "separate-system-tables"; //NOI18N
461
        private static final String ELEMENT_SEPARATE_SYS_TABLES = "separate-system-tables"; //NOI18N
462
        private static final String ELEMENT_USE_SCROLLABLE_CURSORS = "use-scrollable-cursors"; //NOI18N
458
        private static final String ELEMENT_CONNECTION_PROPERTY_NAME = "name"; // NOI18N
463
        private static final String ELEMENT_CONNECTION_PROPERTY_NAME = "name"; // NOI18N
459
        private static final String ELEMENT_CONNECTION_PROPERTY_VALUE = "value"; // NOI18N
464
        private static final String ELEMENT_CONNECTION_PROPERTY_VALUE = "value"; // NOI18N
460
        private static final String ATTR_PROPERTY_VALUE = "value"; // NOI18N
465
        private static final String ATTR_PROPERTY_VALUE = "value"; // NOI18N
Lines 473-478 Link Here
473
        String displayName;
478
        String displayName;
474
        Properties connectionProperties;
479
        Properties connectionProperties;
475
        boolean separateSystemTables = false;
480
        boolean separateSystemTables = false;
481
        Boolean useScrollableCursors = null;
476
        List<String> importantSchemas = new ArrayList<String>();
482
        List<String> importantSchemas = new ArrayList<String>();
477
        List<String> importantCatalogs = new ArrayList<String>();
483
        List<String> importantCatalogs = new ArrayList<String>();
478
        
484
        
Lines 542-547 Link Here
542
                importantCatalogs.add(value);
548
                importantCatalogs.add(value);
543
            } else if (ELEMENT_SEPARATE_SYS_TABLES.equals(qName)) {
549
            } else if (ELEMENT_SEPARATE_SYS_TABLES.equals(qName)) {
544
                separateSystemTables = Boolean.parseBoolean(value);
550
                separateSystemTables = Boolean.parseBoolean(value);
551
            } else if (ELEMENT_USE_SCROLLABLE_CURSORS.equals(qName)) {
552
                useScrollableCursors = Boolean.parseBoolean(value);
545
            }
553
            }
546
        }
554
        }
547
555
(-)a/db/src/org/netbeans/modules/db/explorer/node/ConnectionNode.java (+7 lines)
Lines 89-94 Link Here
89
    private static final String CONNECTIONPROPERTIESDESC = "ConnectionPropertiesDescription"; //NOI18N
89
    private static final String CONNECTIONPROPERTIESDESC = "ConnectionPropertiesDescription"; //NOI18N
90
    private static final String SEPARATESYSTEMTABLES = "SeparateSystemTables"; //NOI18N
90
    private static final String SEPARATESYSTEMTABLES = "SeparateSystemTables"; //NOI18N
91
    private static final String SEPARATESYSTEMTABLESDESC = "SeparateSystemTablesDescription"; //NOI18N
91
    private static final String SEPARATESYSTEMTABLESDESC = "SeparateSystemTablesDescription"; //NOI18N
92
    private static final String USESCROLLABLECURSORS = "UseScrollableCursors"; //NOI18N
93
    private static final String USESCROLLABLECURSORSDESC = "UseScrollableCursorsDescription"; //NOI18N
92
    private static final String FOLDER = "Connection"; // NOI18N
94
    private static final String FOLDER = "Connection"; // NOI18N
93
    private static final RequestProcessor RP = new RequestProcessor(ConnectionNode.class.getName());
95
    private static final RequestProcessor RP = new RequestProcessor(ConnectionNode.class.getName());
94
    
96
    
Lines 175-180 Link Here
175
                && val instanceof Boolean) {
177
                && val instanceof Boolean) {
176
            connection.setSeparateSystemTables((Boolean) val);
178
            connection.setSeparateSystemTables((Boolean) val);
177
            refreshNode = false;
179
            refreshNode = false;
180
        } else if (nps.getName().equals(USESCROLLABLECURSORS)
181
                && val instanceof Boolean) {
182
            connection.setUseScrollableCursors((Boolean) val);
183
            refreshNode = false;
178
        }
184
        }
179
185
180
        super.setPropertyValue(nps, val);
186
        super.setPropertyValue(nps, val);
Lines 197-202 Link Here
197
            addProperty(REMEMBERPW, REMEMBERPWDESC,
203
            addProperty(REMEMBERPW, REMEMBERPWDESC,
198
                    Boolean.class, !connected, connection.rememberPassword());
204
                    Boolean.class, !connected, connection.rememberPassword());
199
            addProperty(SEPARATESYSTEMTABLES, SEPARATESYSTEMTABLESDESC, Boolean.class, true, connection.isSeparateSystemTables());
205
            addProperty(SEPARATESYSTEMTABLES, SEPARATESYSTEMTABLESDESC, Boolean.class, true, connection.isSeparateSystemTables());
206
            addProperty(USESCROLLABLECURSORS, USESCROLLABLECURSORSDESC, Boolean.class, true, connection.isUseScrollableCursors());
200
            addProperty(CONNECTIONPROPERTIES, CONNECTIONPROPERTIESDESC, Properties.class, !connected, connection.getConnectionProperties());
207
            addProperty(CONNECTIONPROPERTIES, CONNECTIONPROPERTIESDESC, Properties.class, !connected, connection.getConnectionProperties());
201
            Property<?> ps = getSheet().get(Sheet.PROPERTIES).get(CONNECTIONPROPERTIES);
208
            Property<?> ps = getSheet().get(Sheet.PROPERTIES).get(CONNECTIONPROPERTIES);
202
            ps.setValue("canEditAsText", Boolean.FALSE);                //NOI18N
209
            ps.setValue("canEditAsText", Boolean.FALSE);                //NOI18N
(-)a/db/src/org/netbeans/modules/db/resources/connection-1_2.dtd (+70 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
The contents of this file are subject to the terms of the Common Development
4
and Distribution License (the License). You may not use this file except in
5
compliance with the License.
6
7
You can obtain a copy of the License at http://www.netbeans.org/cddl.html
8
or http://www.netbeans.org/cddl.txt.
9
10
When distributing Covered Code, include this CDDL Header Notice in each file
11
and include the License file at http://www.netbeans.org/cddl.txt.
12
If applicable, add the following below the CDDL Header, with the fields
13
enclosed by brackets [] replaced by your own identifying information:
14
"Portions Copyrighted [year] [name of copyright owner]"
15
16
The Original Software is NetBeans. The Initial Developer of the Original
17
Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
18
Microsystems, Inc. All Rights Reserved.
19
-->
20
21
<!--- The root connection element. -->
22
<!ELEMENT connection (driver-class,driver-name,database-url,schema,user,password?,use-scrollable-cursors?,separate-system-tables?)>
23
24
<!--- The driver class. -->
25
<!ELEMENT driver-class EMPTY>
26
<!ATTLIST driver-class
27
    value CDATA #REQUIRED
28
>
29
30
<!--- The driver name. -->
31
<!ELEMENT driver-name EMPTY>
32
<!ATTLIST driver-name
33
    value CDATA #REQUIRED
34
>
35
36
<!--- The database URL. -->
37
<!ELEMENT database-url EMPTY>
38
<!ATTLIST database-url
39
    value CDATA #REQUIRED
40
>
41
42
<!--- The schema to which to connect by default. -->
43
<!ELEMENT schema EMPTY>
44
<!ATTLIST schema
45
    value CDATA #REQUIRED
46
>
47
48
<!--- The database user to connect as. -->
49
<!ELEMENT user EMPTY>
50
<!ATTLIST user 
51
    value CDATA #REQUIRED
52
>
53
54
<!--- Should be system tables shown separately? -->
55
<!ELEMENT separate-system-tables EMPTY>
56
<!ATTLIST separate-system-tables
57
    value (true | false) #REQUIRED
58
>
59
60
<!--- Allow JDBC support for scrollable cursors? -->
61
<!ELEMENT use-scrollable-cursors EMPTY>
62
<!ATTLIST use-scrollable-cursors
63
    value (true | false) #REQUIRED
64
>
65
66
<!--- The database password (hashed). -->
67
<!ELEMENT password EMPTY>
68
<!ATTLIST password 
69
    value CDATA #REQUIRED
70
>
(-)a/db/src/org/netbeans/modules/db/resources/mf-layer.xml (+8 lines)
Lines 624-629 Link Here
624
                <file name="DTD_Database_Connection_1_1" url="connection-1_1.dtd">
624
                <file name="DTD_Database_Connection_1_1" url="connection-1_1.dtd">
625
                    <attr name="hint.originalPublicID" stringvalue="-//NetBeans//DTD Database Connection 1.1//EN"/>
625
                    <attr name="hint.originalPublicID" stringvalue="-//NetBeans//DTD Database Connection 1.1//EN"/>
626
                </file>
626
                </file>
627
                <file name="DTD_Database_Connection_1_2" url="connection-1_2.dtd">
628
                    <attr name="hint.originalPublicID" stringvalue="-//NetBeans//DTD Database Connection 1.2//EN"/>
629
                </file>
627
            </folder>
630
            </folder>
628
        </folder>
631
        </folder>
629
        
632
        
Lines 649-654 Link Here
649
                    <attr name="instanceOf" stringvalue="org.openide.loaders.Environment$Provider"/>
652
                    <attr name="instanceOf" stringvalue="org.openide.loaders.Environment$Provider"/>
650
                    <attr name="instanceCreate" methodvalue="org.netbeans.modules.db.explorer.DatabaseConnectionConvertor.createProvider"/>
653
                    <attr name="instanceCreate" methodvalue="org.netbeans.modules.db.explorer.DatabaseConnectionConvertor.createProvider"/>
651
                </file>
654
                </file>
655
                <file name="DTD_Database_Connection_1_2.instance">
656
                    <attr name="instanceClass" stringvalue="org.netbeans.modules.db.explorer.DatabaseConnectionConvertor"/>
657
                    <attr name="instanceOf" stringvalue="org.openide.loaders.Environment$Provider"/>
658
                    <attr name="instanceCreate" methodvalue="org.netbeans.modules.db.explorer.DatabaseConnectionConvertor.createProvider"/>
659
                </file>
652
            </folder>
660
            </folder>
653
        </folder>
661
        </folder>
654
    </folder>
662
    </folder>
(-)a/db/test/unit/src/org/netbeans/modules/db/explorer/bar-connection.xml (-1 / +2 lines)
Lines 1-9 Link Here
1
<?xml version='1.0'?>
1
<?xml version='1.0'?>
2
<!DOCTYPE connection PUBLIC '-//NetBeans//DTD Database Connection 1.1//EN' 'http://www.netbeans.org/dtds/connection-1_1.dtd'>
2
<!DOCTYPE connection PUBLIC '-//NetBeans//DTD Database Connection 1.2//EN' 'http://www.netbeans.org/dtds/connection-1_2.dtd'>
3
<connection>
3
<connection>
4
  <driver-class value='org.bar.BarDriver'/>
4
  <driver-class value='org.bar.BarDriver'/>
5
  <driver-name value='bar_driver'/>
5
  <driver-name value='bar_driver'/>
6
  <database-url value='jdbc:bar:localhost'/>
6
  <database-url value='jdbc:bar:localhost'/>
7
  <schema value='schema'/>
7
  <schema value='schema'/>
8
  <user value='user'/>
8
  <user value='user'/>
9
  <use-scrollable-cursors value='false'/>
9
</connection>
10
</connection>
(-)a/db/test/unit/src/org/netbeans/modules/db/explorer/null-pwd-connection.xml (-1 / +2 lines)
Lines 1-9 Link Here
1
<?xml version='1.0'?>
1
<?xml version='1.0'?>
2
<!DOCTYPE connection PUBLIC '-//NetBeans//DTD Database Connection 1.1//EN' 'http://www.netbeans.org/dtds/connection-1_1.dtd'>
2
<!DOCTYPE connection PUBLIC '-//NetBeans//DTD Database Connection 1.2//EN' 'http://www.netbeans.org/dtds/connection-1_2.dtd'>
3
<connection>
3
<connection>
4
  <driver-class value='org.bar.BarDriver'/>
4
  <driver-class value='org.bar.BarDriver'/>
5
  <driver-name value='bar_driver'/>
5
  <driver-name value='bar_driver'/>
6
  <database-url value='jdbc:bar:localhost'/>
6
  <database-url value='jdbc:bar:localhost'/>
7
  <schema value='schema'/>
7
  <schema value='schema'/>
8
  <user value='user'/>
8
  <user value='user'/>
9
  <use-scrollable-cursors value='false'/>
9
</connection>
10
</connection>

Return to bug 231030