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 148492 - Cannot expllicitly set Database Url when creating new DB connection
Summary: Cannot expllicitly set Database Url when creating new DB connection
Status: VERIFIED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Rob Englander
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-26 14:42 UTC by petrsmid
Modified: 2008-10-02 15:19 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description petrsmid 2008-09-26 14:42:48 UTC
When creating new connection to DB it is not possible to explicitly set Database Url. In Netbeans 6.1 it was possible to
set database url explicitly. Now in Netbeans 6.5 it is imposible - I have to set host, port, database, etc.

We have jdbc connection string which is not able to fit into this fields - it uses two hosts:
jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=czdb03-vip.devlab.ad)
(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=czdb04-vip.devlab.ad)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=devel))(FAILOVER_MODE
=(TYPE = SELECT)(METHOD = BASIC)(RETRIES = 180)(DELAY = 5)))
Comment 1 David Vancouvering 2008-09-26 15:48:01 UTC
If you check the Show JDBC URL checkbox, you should be able to edit the URL.  If the entry field for the URL doesn't
show up or is not editable then please reopen.
Comment 2 petrsmid 2008-09-26 16:12:21 UTC
That is true, but fields host and database are mandatory, so they cannot be empty - there is no need to be mandatory 
when jdbc url is already filled in. And it is not obvious what should be filled in in the field 'host', when there are
more than one hosts (as in example).
Comment 3 Rob Englander 2008-09-26 16:24:06 UTC
If the URL you've entered has, for example, a proper host it will be added to the Host field.  The URL
gets parsed and the appropriate fields populated.  However, that doesn't happen until focus is moved away
from the URL entry field.  So if you enter your URL and then change focus to another field, you should see
this happen.  This should also work if you simply click OK.  If that's not true, that would be a bug.

I don't know what to expect if there are multiple hosts.  Maybe the URL parsing doesn't handle that?
Comment 4 David Vancouvering 2008-09-26 17:13:12 UTC
I have never tested with two hosts - and the URL below looks very very different from the URL template I got from the
Oracle documentation.  

It looks like you're stuck - you can't connect to the database with the URL specified below.  If that's true, then I
think this is a P1 - you have no workaround.

I think what we need is a checkbox that lets you override the parsing of the URL and just let you specify the URL and
have done with it.

Rob, can you take this one please?
Comment 5 Rob Englander 2008-09-26 17:16:43 UTC
Sure thing.
Comment 6 Jayashri Visvanathan 2008-09-26 18:20:14 UTC
From the discussion, its not clear to me why host and password are mandatory. I am curious as to why it changed it 6.5.
That also seems like a simpler change than adding the check box.
Comment 7 Rob Englander 2008-09-26 18:31:03 UTC
I don't think that really addresses the issue.  The problem here is that there are valid URLs that we are not parsing
correctly.  The required fields are called out because the failure to parse means we don't know how to fill in those fields.

So, it seems there are two approaches:

1) allow the user to override the parsing if they believe the URL is, in fact, correct.
2) rewrite the URL parser.

2 is not an option right now IMO.  And I'm not sure we'd want to spend time writing URL parsers for every
RDBMS.  We take a simple approach right now.  Is this worth doing?

If anyone has another idea on how to deal with this please jump in.
Comment 8 David Vancouvering 2008-09-26 19:17:22 UTC
We should allow a manual override, IMHO.  I am sure there are other cases lurking out there that don't fit into the mold
of our URL parser, and we don't want to prevent users from being able to establish connections just because we don't
handle their URL.
Comment 9 Rob Englander 2008-09-29 14:37:04 UTC
I think something slightly different than overriding would work better.  Either at the very top of the dialog, or just
under the driver combo box, we can provide 2 radio buttons.  One for using the field entry mode (this is what we've got
now, and this will be the default).  The other one is to use direct URL entry.  In this mode, the individual fields are
not shown; only the URL entry field is shown.  It will not be parsed or validated.  It's up to the user to get it right.

We'll also need to keep track of whether the connection is using direct url mode or not.  And we'll need to do the right
thing when the user chooses to modify the connection using the property editor.

This seems like a substantial "fix" at this point.

I also don't think this is a P1.  Maybe the following workaround, albeit klunky, is enough until this enhancement can be
made in the next release?

The workaround is to use the current input fields as is.  Don't worry that it's not the correct JDBC URL.  Then use the
property editor to modify the URL to your liking.  Would that be sufficient (and sufficiently annoying) for now?
Comment 10 James Branam 2008-09-30 14:20:56 UTC
I'll add this information to the existing help topic
Comment 11 Rob Englander 2008-09-30 14:47:33 UTC
James, I hope to have this completed and committed today.  Let me know if you need
me to give you a description before then (it's somewhat different and simpler than the original
description).

I'd like to give someone (David?) a chance to look at it as well.
Comment 12 petrsmid 2008-09-30 15:29:35 UTC
> The workaround is to use the current input fields as is.  Don't worry that it's not the correct JDBC URL.  Then use the
> property editor to modify the URL to your liking.  Would that be sufficient (and sufficiently annoying) for now?

The workaround seems not working well - I need an existing connection to modify for the workaround. But I have no
connection and I cannot create any, because the mandatory fields have to be filled with true values otherwise it tells
me "Unable to add connection. Cannot establlish a connection to ...". Thatswhy I cannot create fake connection, which I
could be able to modify afterwards.

Thatswhy I whould probably need another existing Oracle database to create the connection to which I can connect just
with mandatory fields.

Well, maybe it would a possibility to install locally Oracle XE, connect to it and afterwards modify the URL, but ...
huh.. it is kind of complicated..
Comment 13 Rob Englander 2008-09-30 15:33:28 UTC
Yes, you're right about the work around.  It's not right.  

In any case, the fix is almost done.  You'll be able to enter the full url directly.
Comment 14 Rob Englander 2008-09-30 19:41:57 UTC
6ba7b619779c
Comment 15 Quality Engineering 2008-10-01 05:58:22 UTC
Integrated into 'main-golden', will be available in build *200810010201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/6ba7b619779c
User: Rob Englander <mindstream@netbeans.org>
Log: #148492 NewConnection dialog now supports the option to enter the complete JDBC URL directly without using field validation.
Comment 16 Roman Mostyka 2008-10-01 10:50:44 UTC
Verified with build 081001.
petrsmid, can you verify with latest build that the fix is good for you.
Thanks.
Comment 17 petrsmid 2008-10-02 13:46:15 UTC
Yes, that works fine. Thank You guys.
Comment 18 James Branam 2008-10-02 15:19:06 UTC
I have added information about this to the existing Help topic.