| View previous topic :: View next topic |
| Author |
Message |
frankgrimes97
Joined: 20 Dec 2010 Posts: 10
|
Posted: Mon Dec 20, 2010 7:19 pm Post subject: Modify list of JDBC drivers presented to users in DB module? |
|
|
Hi All,
I have a NetBeans platform application which makes use of the DB module.
I am bundling JDBC drivers for our supported databases and I would like the list only include those.
It looks as though the list is driven by org.netbeans.modules.db.util.DriverListUtil.
However, I see no way to edit (e.g. through a layer.xml) the drivers presented to the user.
Is there any way to achieve this without modifying the DB module's code?
Regards,
Frank Grimes
|
|
| Back to top |
|
 |
akochnev
Joined: 29 Sep 2010 Posts: 62
|
Posted: Tue Dec 21, 2010 3:40 am Post subject: [platform-dev] Re: Modify list of JDBC drivers presented to users in DB module? |
|
|
| Wrap the JDBC driver as a library module. Create a new module that depends on the driver library module, and add an xml file with the following content somewhere in the new module (the example below is for the sql server driver - if you're using something different, you'll need to have a different value in the class and the name of the jar file with the driver). :
|
|
| Back to top |
|
 |
frankgrimes97
Joined: 20 Dec 2010 Posts: 10
|
Posted: Tue Dec 21, 2010 3:15 pm Post subject: |
|
|
Sorry, it looks like your XML sample got eaten by the forum gremlins... could you please re-post your sample?
Thanks!
|
|
| Back to top |
|
 |
akochnev
Joined: 29 Sep 2010 Posts: 62
|
Posted: Wed Dec 22, 2010 4:09 am Post subject: Sample xml reposted |
|
|
Wrap the JDBC driver as a library module. Create a new module that depends on the driver library module, and add an xml file with the following content somewhere in the new module (the example below is for the sql server driver - if you're using something different, you'll need to have a different value in the class and the name of the jar file with the driver). :
<?xml version='1.0'?>
<!DOCTYPE driver PUBLIC '-//NetBeans//DTD JDBC Driver 1.1//EN' 'http://www.netbeans.org/dtds/jdbc-driver-1_1.dtd'>
<driver>
<name value='SQLServer2008'/>
<display-name value='Microsoft SQL Server 2008'/>
<class value='com.microsoft.sqlserver.jdbc.SQLServerDriver'/>
<urls>
<url value="nbinst:/modules/ext/sqljdbc4.jar"/>
</urls>
</driver>
Finally, register the xml file that you just created in your layer.xml:
<filesystem>
<folder name="Databases">
<folder name="JDBCDrivers">
<file name="SQLServer2008Driver.xml" url="SQLServer2008Driver.xml"/>
</folder>
</folder>
</filesystem>
I hope this helps.
|
|
| Back to top |
|
 |
frankgrimes97
Joined: 20 Dec 2010 Posts: 10
|
Posted: Wed Dec 22, 2010 7:53 pm Post subject: |
|
|
The above-mentioned configuration only worked by adding the drivers in the Services tab.
The new connection driver drop-down list still includes all possible drivers (those not in the classpath are red)
Attached are the screen shots of what I mean...
| Description: |
|
| Filesize: |
2.74 KB |
| Viewed: |
2515 Time(s) |

|
| Description: |
|
| Filesize: |
23.02 KB |
| Viewed: |
2515 Time(s) |

|
|
|
| Back to top |
|
 |
frankgrimes97
Joined: 20 Dec 2010 Posts: 10
|
Posted: Thu Dec 23, 2010 2:56 pm Post subject: |
|
|
| Is my only option really to fork/clone the DB module and trim the list down in code?
|
|
| Back to top |
|
 |
Aleksandar Kochnev Posted via mailing list.
|
Posted: Thu Dec 23, 2010 9:29 pm Post subject: [platform-dev] Re: Modify list of JDBC drivers presented to users in DB module? |
|
|
My fault, I didn't read the original question carefully enough. You might need to crack open the sources of the module you're talking about and see how that list is being generated.
Alex Kochnev
Architect, Quality Assurance
CommerceHub
255 Fuller Road Suite 327
Albany, NY 12203
518.810.0700 x3876
http://www.commercehub.com
-----Original Message-----
From: frankgrimes97 [mailto:address-removed]
Sent: Wednesday, December 22, 2010 2:54 PM
To: address-removed
Subject: [platform-dev] Modify list of JDBC drivers presented to users in DB module?
The above-mentioned configuration only worked by adding the drivers in the Services tab.
The new connection driver drop-down list still includes all possible drivers (those not in the classpath are red)
Attached are the screen shots of what I mean...
Attachments:
http://forums.netbeans.org//files/services_drivers_186.png
http://forums.netbeans.org//files/jdbc_driver_list_207.png
|
|
| Back to top |
|
 |
frankgrimes97
Joined: 20 Dec 2010 Posts: 10
|
Posted: Thu Dec 23, 2010 9:39 pm Post subject: |
|
|
Well, it definitely looks like it's hard-coded in org.netbeans.modules.db.util.DriverListUtil.
Assuming no mechanism currently exists, how would one go about contributing a patch to the DB module to allow this to be configurable?
|
|
| Back to top |
|
 |
Aleksandar Kochnev Posted via mailing list.
|
Posted: Thu Dec 30, 2010 2:21 am Post subject: [platform-dev] Re: Modify list of JDBC drivers presented to users in DB module? |
|
|
Frank,
Create a defect, fix the issue in your local repo, export a patch and attach the patch to the defect. The module owner will review and apply to the main source tree.
Alex Kochnev
Architect, Quality Assurance
CommerceHub
255 Fuller Road Suite 327
Albany, NY 12203
518.810.0700 x3876
http://www.commercehub.com
-----Original Message-----
From: frankgrimes97 [mailto:address-removed]
Sent: Thursday, December 23, 2010 4:39 PM
To: address-removed
Subject: [platform-dev] Modify list of JDBC drivers presented to users in DB module?
Well, it definitely looks like it's hard-coded in org.netbeans.modules.db.util.DriverListUtil.
Assuming no mechanism currently exists, how would one go about contributing a patch to the DB module to allow this to be configurable?
|
|
| Back to top |
|
 |
Kris Scorup Posted via mailing list.
|
Posted: Thu Dec 30, 2010 5:05 pm Post subject: [platform-dev] Re: Modify list of JDBC drivers presented to users in DB module? |
|
|
http://netbeans.org/community/contribute/patches.html
On Thu, Dec 23, 2010 at 1:39 PM, frankgrimes97 <address-removed ([email]address-removed[/email])> wrote:
| Quote: | Well, it definitely looks like it's hard-coded in org.netbeans.modules.db.util.DriverListUtil.
Assuming no mechanism currently exists, how would one go about contributing a patch to the DB module to allow this to be configurable?
|
--
[b]Kris Scorup[/b]
Datahead Software Solutions
27733 215th PL SE
Maple Valley, WA 98038
425-310-2527 phone
http://www.dataheadsolutions.com
address-removed ([email]address-removed[/email])
|
|
| Back to top |
|
 |
|