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.

Bug 211632 - DB structure isn't available for connection to MS SQL using SQLServerDriver, ver.4
Summary: DB structure isn't available for connection to MS SQL using SQLServerDriver, ...
Status: VERIFIED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: DB schema (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Jaroslav Havlin
URL:
Keywords: NETFIX
Depends on:
Blocks:
 
Reported: 2012-04-24 11:53 UTC by Sergey Petrov
Modified: 2012-05-15 14:48 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
fresh message.log (39.61 KB, application/octet-stream)
2012-04-25 08:41 UTC, Sergey Petrov
Details
screen for conneciton node (12.88 KB, image/png)
2012-04-25 08:45 UTC, Sergey Petrov
Details
proposed patch (1.13 KB, patch)
2012-04-30 19:01 UTC, matthias42
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Petrov 2012-04-24 11:53:08 UTC
DB structure and schema isn't available for connection to microsoft sql server.

Tried to setup a connection, I have psb database I can see a table dbo.Persons inside the database, I have a connection with usage of Microsoft JDBC Driver 4.0 for SQL Server.
My connection url is jdbc:sqlserver://localhost\SQLEXPRESS:1155;databaseName=psb;integratedSecurity=true
I can see master, model, msdb, psb, tempdb nodes, but no one contain any content.
On other side I can succesfully execute sql command "select * from dbo.Persons" on the connection.

I'm not completely sure it's not user error as microsoft sql server setup is new for me.
Comment 1 Sergey Petrov 2012-04-24 11:54:11 UTC
Also if I select the connection in Persistence|Database Schema I see no tables.
Comment 2 Sergey Petrov 2012-04-24 11:54:47 UTC
Server is Microsoft SQL Server 2008
Comment 3 Jan Peska 2012-04-24 14:11:17 UTC
Please attach message log, it could be useful...
Comment 4 Sergey Petrov 2012-04-25 08:41:04 UTC
Created attachment 118725 [details]
fresh message.log

it's fresh build, register driver and connection with sql authorization in this session and try to expand databases. No exceptions and no result.
Comment 5 Sergey Petrov 2012-04-25 08:45:26 UTC
Created attachment 118726 [details]
screen for conneciton node

On top is derby node successfully expanded and below is sqlsever node without ability to expand more
Comment 6 matthias42 2012-04-25 17:56:57 UTC
You could try to verify the database permissions by connecting to the database with the administration tool from microsoft (enforce use of tcp as connection method and use the same account).

I tested today against a 2008 server and got a correct listing of all databases and for my target also a table listing.
Comment 7 Sergey Petrov 2012-04-25 20:20:20 UTC
Yes, I see tables if connect with SQL Server Management Studio in both modes - Windows authentication and sql server authentication (with same sa account as on screenshot) And don't see from nb in both modes. Also sa is set as owner of one of tables.
have you tried the same jdbc? i.e.sqljdbc4.jar from Microsoft JDBC Driver 4.0 for SQL Server ?
Comment 8 Sergey Petrov 2012-04-26 05:56:53 UTC
tried "Microsoft SQL Server JDBC Driver 3.0 with JRE7 getDate compatibility" and I can see schemas/tables now, but microsoft recommend Driver 4.0 on 3.0 driver page.
Comment 9 matthias42 2012-04-30 19:01:59 UTC
Created attachment 118898 [details]
proposed patch

Ah! They changed the driver name and so the MSSQL specific driver model was not applied. Please see attached patch for more information.

Old check:
driverName.contains("Microsoft SQL Server") || driverName.contains("jTDS")

Driver name 3.0: Microsoft SQL Server JDBC Driver 3.0
Driver name 4.0: Microsoft JDBC Driver 4.0 for SQL Server

The patch checks presence of "Microsoft" and "SQL Service" matching both variant.
Comment 10 Jiri Rechtacek 2012-05-02 07:25:12 UTC
(In reply to comment #9)
> Created attachment 118898 [details]
> proposed patch
> 
> Ah! They changed the driver name and so the MSSQL specific driver model was not
> applied. Please see attached patch for more information.
> 
> Old check:
> driverName.contains("Microsoft SQL Server") || driverName.contains("jTDS")
Nice hint. Thanks. Honzo, could you apply it and ask Sergey for verification? Thank you

> 
> Driver name 3.0: Microsoft SQL Server JDBC Driver 3.0
> Driver name 4.0: Microsoft JDBC Driver 4.0 for SQL Server
> 
> The patch checks presence of "Microsoft" and "SQL Service" matching both
> variant.
Comment 11 Jaroslav Havlin 2012-05-14 11:36:31 UTC
Thank you, Matthias.
Applied as http://hg.netbeans.org/core-main/rev/89655183182d.
Sergey, can you please verify this fix?
Comment 12 Quality Engineering 2012-05-15 10:10:03 UTC
Integrated into 'main-golden', will be available in build *201205150400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/89655183182d
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #211632 - DB structure isn't available for connection to MS SQL using SQLServerDriver, ver.4
Comment 13 Sergey Petrov 2012-05-15 14:48:02 UTC
v4 works for me now