Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MS SQL: Exception while browsing table data #719

Closed
Otiel opened this issue Sep 12, 2016 · 4 comments
Closed

MS SQL: Exception while browsing table data #719

Otiel opened this issue Sep 12, 2016 · 4 comments
Assignees
Milestone

Comments

@Otiel
Copy link

Otiel commented Sep 12, 2016

Upon opening the "Data" tab of a table (named "StatusOnOff" on a MS SQL connection, using Microsoft driver), I get the following error:

SQL Error [208] [S0002]: Invalid object name 'dbo.StatusOnOff'.

Stack trace:

org.jkiss.dbeaver.model.exec.DBCException: SQL Error [208] [S0002]: Invalid object name 'dbo.StatusOnOff'.
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:141)
    at org.jkiss.dbeaver.model.impl.jdbc.struct.JDBCTable.readData(JDBCTable.java:192)
    at org.jkiss.dbeaver.ui.controls.resultset.ResultSetDataPumpJob.run(ResultSetDataPumpJob.java:139)
    at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:103)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'dbo.StatusOnOff'.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:792)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:689)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:662)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:345)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:138)
    ... 4 more

My .log file:

!ENTRY org.jkiss.dbeaver.model 4 0 2016-09-12 11:50:58.411
!MESSAGE org.jkiss.dbeaver.model.exec.DBCException: SQL Error [208] [S0002]: Invalid object name 'dbo.StatusOnOff'.
!SUBENTRY 1 org.jkiss.dbeaver.model 4 0 2016-09-12 11:50:58.411
!MESSAGE SQL Error [208] [S0002]: Invalid object name 'dbo.StatusOnOff'.
!STACK 0
org.jkiss.dbeaver.model.exec.DBCException: SQL Error [208] [S0002]: Invalid object name 'dbo.StatusOnOff'.
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:141)
    at org.jkiss.dbeaver.model.impl.jdbc.struct.JDBCTable.readData(JDBCTable.java:192)
    at org.jkiss.dbeaver.ui.controls.resultset.ResultSetDataPumpJob.run(ResultSetDataPumpJob.java:139)
    at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:103)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'dbo.StatusOnOff'.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:792)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:689)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:662)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:345)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:138)
    ... 4 more
!SUBENTRY 2 org.jkiss.dbeaver.model 4 0 2016-09-12 11:50:58.411
!MESSAGE Invalid object name 'dbo.StatusOnOff'.
!STACK 0
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'dbo.StatusOnOff'.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:792)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:689)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:662)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:345)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:138)
    at org.jkiss.dbeaver.model.impl.jdbc.struct.JDBCTable.readData(JDBCTable.java:192)
    at org.jkiss.dbeaver.ui.controls.resultset.ResultSetDataPumpJob.run(ResultSetDataPumpJob.java:139)
    at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:103)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

And my dbeaver-debug.log file:

2016-09-12 11:50:21.152 - DBeaver 3.7.4 is starting
2016-09-12 11:50:21.152 - Install path: 'file:/C:/Program Files/DBeaver/'
2016-09-12 11:50:21.152 - Instance path: 'file:/C:/Users/******/.dbeaver/'
2016-09-12 11:50:21.152 - Memory available 245Mb/3614Mb
2016-09-12 11:50:21.168 - Starting RMI server at 49373
2016-09-12 11:50:21.277 - Initialize display
2016-09-12 11:50:23.186 - Initializing DBeaver 3.7.4
2016-09-12 11:50:23.186 - Host plugin: org.jkiss.dbeaver.core.application 3.7.4
2016-09-12 11:50:23.186 - Initialize Core...
2016-09-12 11:50:23.373 - Core initialized (187ms)
2016-09-12 11:50:23.373 - Configure workbench window
2016-09-12 11:50:23.451 - Create actions
2016-09-12 11:50:23.919 - Initialize workbench window
2016-09-12 11:50:23.935 - Finish initialization
2016-09-12 11:50:35.666 - Connect with '172.16.129.71' (mssql_ms-15709dc3b05-6e71bc867d99f620)
2016-09-12 11:50:36.259 - Connected (mssql_ms-15709dc3b05-6e71bc867d99f620)
2016-09-12 11:50:50.486 - Can't get column 'SOURCE_DATA_TYPE': The column name SOURCE_DATA_TYPE is not valid.
2016-09-12 11:50:50.502 - Can't get column 'SOURCE_DATA_TYPE': The column name SOURCE_DATA_TYPE is not valid.
2016-09-12 11:50:53.434 - Skip statistics index 'STATUSONOFF_#DBOBJ' in 'dbo.StatusOnOff'

DBeaver version : 3.7.4
For information, I didn't have this issue using v3.7.3 with the exact same configuration. I tried updating the Microsoft drivers for the connection, no luck.

I can successfully see the "Diagram" tab and all pages of the "Properties" tab (Info, Columns, Unique Keys... - all data seems correct except the "Row Count" which is equal to -1 on all tables), it is only the "Data" tab that raises this error.

@serge-rider
Copy link
Member

I think this issue appeared in 3.7.3.
Since then DBeaver uses "short" table names in MSSQL. It is a side-effect of #521 fix.

Switch active database (right click on database in navigator -> "Set Active") to the database to which your table belongs.
I'll think about some better solution (better than "short names" use).

@Otiel
Copy link
Author

Otiel commented Sep 12, 2016

Thanks, switching active database fixes my problem.

But that would be good indeed to find a better solution since it can be dangerous if you consider the following scenario, with the hypothesis that I have two databases with the same structure - for instance one for production and one for development:

  • Set production database as active (by error - instead of the development one)
  • Browse data on a development table. The "Data" tab shows the selected database as the development one, but it is the data of the production one that is shown. I guess making modification will also affect the production database.

@serge-rider serge-rider added this to the 3.7.5 milestone Sep 12, 2016
@serge-rider serge-rider self-assigned this Sep 12, 2016
@serge-rider
Copy link
Member

Agreed.
Although I don't think it is a good idea to have dev and prod databses in the same SQL Server instance - sooner or later somebody will make a mistake.

I'll fix meta model so different table names will be used for DDL and DML.

@Otiel
Copy link
Author

Otiel commented Sep 26, 2016

I confirm this is fixed for me in 3.7.5. Thanks for the quick resolution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants