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.
This request has been submitted by one of our customer. We also face the problem while doing the same. Problem Details : I'm using NetBeans 5.5 creating a Entity bean from a SQL Server 2005 database. The tables in the database do not belong to the default dbo schema. I've created 3 seperate schemas(bmd, agdia, and abook) for the various tables in the database for ease of administration of priviledges. When try to generate the Entity Classes from Database.. for the project in the NetBeans IDE from database wizard, I put in all the connection information and I am able to connect. However, the Advanced tab NEVER shows the 3 schemas that I created. The connection URL is correct. I can see all the other default schemas including dbo but the custom schemas(bmd, agdia, and abook) do not show up in the select schema: drop down. If I simply create just the connection by going to the Runtime->Databases section in the NetBeans IDE, I can create the connection to the specified schema and navigate to the tables just fine. When I use that EXACT connection in the CMP Entity bean from database wizard, it's back to the same old behavior, no custom schemas in the Advanced tab. I am able to create CMP beans just fine for the dbo schema. Customer Steps to create the schemas & tables : In SQL Server 2005 I have created a database. The name of the database is "InventoryControl" this database consists of about 30 tables. By default these 30 tables are created using the dbo schema. Example dbo.TableName1, dbo.TableName2, etc. I have changed that. In the InventoryControl database I've created 3 schemas under Security->Schemas. The schema names are bmd, agdia, and abook. I then changed the tables to be part of the new schemas. Example bmd.TableName1, bmd.TableName2, agdia.TableName1, agdia.TableName2, abook.TableName1, abook.TableName2 I then proceeded to explain that I was able to create a connection under Runtime -> Database to this database "InventoryControl" and I am able to type in the schema (bmd, abook, or agdia) as part of the properties of the connection. Doing this I can browse all the tables for that specific schema in the "InventoryControl" database. "While creating the schemas under Security in InventoryControl database in MS SQL Server 2005, Can you tell us which Schema owner: did you select in Browse for Objects window??" dbo was selected for the schema owner. So you should be able to set up the same environment by creating the custom schema and selecting dbo as the schema owner. Attached is the entire database creation script including schemas. All you need to do is create a login with a username of "sunserver" and any password in the main SQL Server Security section. You don't really need to use that login for testing (the sa password is fine). However it will allow the database creation script to execute. If the script doesn't execute I wouldn't spend much time trying to debug the script. Simply creating the schemas with dbo as the owner and changing the tables to use the schema should do the trick. No roles are used in my case. By looking at the script there is nothing really fancy as far as permissions go. Attachments : Database SQL File. SQL Tables & Schema & SQL Drop Schema pictures.
Created attachment 48723 [details] SQL File
Created attachment 48724 [details] Problem Pictures
Issues occurs on both NetBeans 5.5 & 5.5.1 versions. Tried connecting using Microsoft SQL Server 2005 JDBC Driver 1.1 & 1.2 versions(sqljdbc.jar) but still the problems exists. Does not display any customer schemas in the select schema : drop down list under Advanced Tab while creating the Entity classes......
This is not an issue in NetBeans. The MS SQL Server 2005 JDBC drivers (sqljdbc.jar) do not return the schemas from DatabaseMetaData.getSchemas(). Instead, they return the database users. I checked with another Java database tool and it gives the same result as NetBeans. I can't think of a workaround other than using database users instead of schemas for separation, although I understand that may be impractical or perhaps even impossible, depending on the customer's security requirements. I also checked the jTDS driver, but it doesn't return the schemas either. Downgrading to P3, since this is not an issue in NetBeans. Will probably close as INVALID soon.
Closing according to desc5.
Should we release-note this? It sounds like the bug is in the database, not the driver, since jTDS doesn't work either. Either way, it's a use case that doesn't work in NetBeans, so we should warn the user. The best case would be to present some sort of warning when the user tries to connect. But, I'm not sure there's an obvious place to do this, without being intrusive. When the driver is added? When the connection is created? When the user connects? A release note is a fallback, and I think that's adequate in this case.
It's not a bug in the database, it's in the driver. Both drivers -- they do the same thing. Actually I'm not sure it can be even considered a bug. MS SQL 2005 has both users and schemas, and JDBC has only schemas. The drivers authors had to choose which of those entities to support in JDBC (and it's good they made the same choice). I don't see much point in putting this in the release notes. Generally, you only want to put very important issues in the release notes -- those that many users are likely to run into. A bug in a driver which has only been reported once in the two years or so I'm working the databases does not IMHO qualify.