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.
Connecting to a MySQL doesn't always require a port number in the URL After adding a connection it turns out that a ':' is included in the url following the server name e.g. jdbc:mysql://jbrave-pc1.sfbay.sun.com:/travel Possibly, the culprit is line 606 of ResourceConfigurator where the serverPort is set to hostName + ":" + portNumber; Unfortunately portNumber would be empty for the jdbc url mentioned above As a result, JDBC applications (that use urls without port numbers) and serverplugins to obtain database resources will fail to connect to databases.
work-around... put the port into the URL...
Steps to reproduce? I cannot tell which UI elements that deal with JDBC URL's is getting used.
The initial evaluation may be incorrect - bug in ResourceConfigurator, although the code doesn't look correct, wouldn't work if a URL doesn't contain a port number. Here is the code used to obtain the url. ds.getUrl() retrieves a URL that contains the extra colon (assumes a port) public Set<RequestedJdbcResource> getProjectDataSources(Project p) { J2eeModuleProvider jmp = (J2eeModuleProvider)p.getLookup().lookup(J2eeModuleProvider.class); Set<Datasource> dss = jmp.getModuleDatasources(); Set<RequestedJdbcResource> reqDss = new HashSet<RequestedJdbcResource>(); Iterator<Datasource> it = dss.iterator(); while (it.hasNext()) { Datasource ds = it.next(); RequestedJdbcResource r = new RequestedJdbcResource(ds.getJndiName(),ds.getDriverClassName(), ds.getUrl(), null, ds.getUsername(), ds.getPassword(), null); reqDss.add(r); } return reqDss; }
It is still unclear where you entered the jdbc url and/or other connection information in the first place. Please provide some indication of the user actions that you took.... The code snippet you are proving contains no serverplugin code. What type of project were you working with?
In the Runtime tab, after adding the MySQL driver and connection with url missing the port number (not needed when the default port number is used) Connection to MySQL is successful - View Data works. The problem occurs when trying to obtain the project's datasource. Somehow, an extra colon is added to the url. As a result binding a MySQL rowset to a VWP component fails. I had to add a hack in VWP to get around this invalid url problem. The code provided to obtain the project's datasource is the code used to obtain the url. In the code provided, although Datasource and J2eeModuleProvider are not from the plugin, however, in serverplugins, ConfigurationSupportImpl there is a getDatasources method. The Datasource url is not retrieved correctly as described. I don't know if the bug is in getDatasources or some other method to retrieve a datasource, but appears to be somewhere in the plugin or j2ee module
*** Issue 86586 has been marked as a duplicate of this issue. ***
With Visual WebPack 6.0 M8 with a Java EE 5 project and a MySQL connection which doesn't include a port number, drag and drop a database table to the Designer complains about a missing port number. Can this be fixed for M9?
This bug is still there. This is a P1 for visualweb.
ResourceConfigurator is used to create a url for the datasource to be created. But if a JDBC URL does not contain a port number then a ":" is injected in the url: jdbc:mysql://jbrave-pc1.sfbay.sun.com:/travel Attached is a diff of what to fix
Created attachment 40465 [details] diff of fix for the case when a JDBC URL does not contain a port number
Fixed plugin code which manipulates database's url http://serverplugins.netbeans.org/source/browse/serverplugins/sun/appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/beans/ResourceUtils.java?r1=1.13&r2=1.14 http://serverplugins.netbeans.org/source/browse/serverplugins/sun/appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/beans/ResourceConfigurator.java?r1=1.9&r2=1.10