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.
using nb daily 20080924 on win XP I can make a connection through jdbc-odbc and see the tables . But when executing any query(thus also 'view data') I get no result and this in the output : Error code 0, SQL state null: Invalid Fetch Size Line 1, column 1 I'm using the same connection in 6.1 and there it works. There's no added line in the log. When I make a connection with jtds all works fine. Ironically I started with odbc in nb6.1 because there I couldn't make a connection by jtds. Bart
which database, jdbc-odbc driver ?
From testing and user feedback, jtds has been more reliable than the Microsoft SQL Server driver. So, JDBC-ODBC works with jtds driver?
I reproduced this using internal data source name, ravedbrussia travel/travel
connection is possible but execution fails. I'm having some trouble connectiong using ODBC on Linux so I'll have to go back to Windows and check-out a repository
Appears there's a problem in org.netbeans.modules.db.dataview.output.prepareSQLStatement(...) - setFetchSize (line 520) fails and some exception seems to be thrown - it's swallowed and no error logged. After setFetchSize fails, the finally block of initialDataLoad(...) is entered so no data is return as a result of executing a statment. I created a datasource on rave-db.russia.sun.com, username/password is travel/travel (dbo schema) that connects to Microsoft SQL Server After adding a JDBC-ODBC connection, I tried to execute - select * from dbo.Trip
Regressed since previous release
The exception that would be thrown is (after adding a catch clause in my local build) java.sql.SQLException: Invalid Fetch Size at sun.jdbc.odbc.JdbcOdbcStatement.setFetchSize(JdbcOdbcStatement.java:826) at org.netbeans.modules.db.dataview.output.SQLExecutionHelper.prepareSQLStatement(SQLExecutionHelper.java:522) at org.netbeans.modules.db.dataview.output.SQLExecutionHelper.initialDataLoad(SQLExecutionHelper.java:105) at org.netbeans.modules.db.dataview.output.DataView.create(DataView.java:101) at org.netbeans.modules.db.dataview.api.DataView.create(DataView.java:71) at org.netbeans.modules.db.sql.execute.SQLExecuteHelper.execute(SQLExecuteHelper.java:105) at org.netbeans.modules.db.sql.loader.SQLEditorSupport$SQLExecutor.run(SQLEditorSupport.java:480)
b90aed8757d4
I have some problem with my repository. I can push the fix tomorrow
Created attachment 70764 [details] diffs
changeset will be different then the one mentioned earlier. Mercurial was unable to find my username
I am reassigning issue to you since you are working on a fix.
ff547554831a
Integrated into 'main-golden', will be available in build *200809300201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/ff547554831a User: John Baker <jbaker@netbeans.org> Log: #148487 No queries possible through odbc connection
bartvdc, can You verify that this issue were really fixed, please?
Verified with 20080930, it works. Thanks for the fix, Bart
Verified by reporter.
DVC01 - Please set target mileston DVC02 @@ -173,7 +175,7 @@ public final class DBMetaDataFactory { rs = dbmeta.getImportedKeys(setToNullIfEmpty(table.getCatalog()), setToNullIfEmpty(table.getSchema()), table.getName()); fkList = DBForeignKey.createForeignKeyColumnMap(table, rs); } catch (SQLException e) { - Exceptions.printStackTrace(e); + LOGGER.log(Level.WARNING, e.getMessage()); *Please* do *not* swallow an exception and then print only the message. Those are so difficult to debug. Please use LOGGER.log(Level.WARNING, e.getMessage(), e); This will print out the stack trace to the log. DVC03 - Why is this method swallowing the exception? Why isn't it re-throwing the exception? As a general policy you don't want to swallow exceptions unless you have nobody to throw it to (e.g. you're in the run() method of a background thread or you are the event handler for a user action). DVC04 - @@ -517,7 +517,11 @@ class SQLExecutionHelper { stmt = conn.createStatement(); } int pageSize = dataView.getDataViewPageContext().getPageSize(); - stmt.setFetchSize(pageSize); + try { + stmt.setFetchSize(pageSize); + } catch (SQLException e) { + // ignore - used only as a hint to the driver to optimize + } Please log the exception with the INFO level, it's useful information and if we just swallow it we may not know why things are behaving the way they are...
> - Exceptions.printStackTrace(e); >+ LOGGER.log(Level.WARNING, e.getMessage()); > *Please* do *not* swallow an exception and then print only the message. Those are so difficult to debug. Please use We should *not* be reporting the exception here. Reporting an exception will interrupt the execution of the SQL and the user (at least for using odbc) has no possible way to solve the error. Execution should be allow to complete and any error in executing SQL should be reported in the Output window. If the exception is logged then this is not swallowing the exception. Swallowing is leaving the catch empty or excluding catch. Actually the existing code could swallow other exceptions since previously there was no catch clause, only finally(). > + try { > + stmt.setFetchSize(pageSize); > +} catch (SQLException e) { > + // ignore - used only as a hint to the driver to optimize > + } >Please log the exception with the INFO level, it's useful information and if we just swallow it we may not know why things are behaving the way they are... This try/catch was suggested by the owner of the code. Perhaps we should have the owner of the code fix this.
Integrated into 'main-golden', will be available in build *200810011401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/174cb881b834 User: John Baker <jbaker@netbeans.org> Log: #148487 improve logging