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 151402 - Can't use JDBC connections with Glassfish
Summary: Can't use JDBC connections with Glassfish
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-26 23:27 UTC by _ gtzabari
Modified: 2016-07-07 08:53 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2008-10-26 23:27:40 UTC
dev build 200810261401

When I open persistence.xml Netbeans writes "retrieving datasources". It also complains when one of my project's old
datasources goes missing. It's not clear to me:

1) How to view all the datasources associated with my project and remove them.
2) How to get the Persistence Units dialog in the persistence.xml editor to offer me a list of JDBC sources instead of
datasources.

I somehow got JDBC sources listed in the past but the behavior seems somewhat random. Sometimes I see JDBC sources,
sometimes datasources, and I'm not sure what I'm doing to trigger one or the other.
Comment 1 _ gtzabari 2008-10-26 23:42:33 UTC
It seems that in order to get the dialog box to display JDBC sources you need to:

1) Go into XML editing mode
2) delete <non-jta-data-source>
3) Define the following properties:

eclipselink.jdbc.driver
eclipselink.jdbc.url
eclipselink.jdbc.user
eclipselink.jdbc.password

4) Go back into Design mode. The dialog should now display "JDBC Connection" instead of "Datasource".

I am expecting to be able to transition between Datasouce to JDBC and back using the GUI.
Comment 2 _ gtzabari 2008-11-06 04:45:53 UTC
It seems the steps I listed are not enough. I *still* can't figure out how to get the GUI to ask for a JDBC source. Any
ideas?
Comment 3 _ gtzabari 2008-11-06 05:10:25 UTC
Got it!

There seem to be two bugs.

1) It turns out that if you configured Glassfish as your server in Project Properties then even creating a "New
Persistence Unit" won't offer you JDBC connections. But if you switch to Tomcat suddenly the option shows up.

Netbeans should offer the use of JDBC connections even if you're using Glassfish. For one, they make JUnit testing a
heck of a lot easier!

2) If you're editing persistence.xml by hand you will never be offered the option of JDBC connections unless you first
go into Services -> Databases -> New Connection, and create a new JDBC connection.

Once that's done you must follow the steps I mentioned below:

- Go into XML editing mode
- delete <non-jta-data-source>
- Define the following properties:

eclipselink.jdbc.driver
eclipselink.jdbc.url
eclipselink.jdbc.user
eclipselink.jdbc.password

Then once you return to Design Mode jdbc will show up. Please fix this. It was extremely frustrating to track down :(
Comment 4 _ gowri 2008-11-17 21:20:53 UTC
Reassigning...
Comment 5 Sergey Petrov 2009-07-23 11:20:56 UTC
mostly there are no issues, what kind of  sources is presented is based on project server properties, transaction type,
availability of registred datasources and jdbc sources.
for 2, you don't need jdbc connections in most cases, you can always create new datasource based on required connection.
I don't see a reason to do what you're trying to do in general, what for you need to select jdbc connection in wizard
instead of datasource?

for 1st, some resouces may be defined on server side and you may need to change server configuration, some may be in
sun-resources.xml if you use glassfish. it may be good to have some management for these resources in gui, especially a
way to remove one if ide complains about something. it's some kind of usabuility issue may be consider as enhancment
request also.
Comment 6 _ gtzabari 2009-07-23 18:27:07 UTC
sergeyp,

I want my main codebase and JUnit tests to use the same connection type. As far as I know, there is no easy way to use
datasource connections from JUnit.
Comment 7 Sergey Petrov 2009-07-24 07:29:04 UTC
ok, it looks like a task to allow RESOURCE_LOCAL type of transactions (in persistence unit) be created even in container
based projects. yet it's more like functionality limitation instead of a defect.
Comment 8 Sergey Petrov 2009-07-31 08:39:59 UTC
recently I got a problem with deployment of local transaction to a server(may be it was jboss), so it may not be
possible for some servers to use this trnsaction types, also I see it now more like enhancement (if it's possible) as
unit tests are executed locally and do not have container management unit tests must use local tarnsactions type but
server should use jta trnsactions if it's possible, and even may check and do not allow other types, in general
configurations should be different.
Comment 9 Martin Balin 2016-07-07 08:53:43 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss