[
https://issues.apache.org/jira/browse/DERBY-6757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14173171#comment-14173171
]
Myrna van Lunteren commented on DERBY-6757:
-------------------------------------------
If you're using the ClientDriver, you need to use the networkserver style url
with the //hostname:portnr/ format - because the networkserver is in charge of
creating/connecting to the database.
For example using localhost:
System.out.println(d.connect("jdbc:derby://localhost:1527/C:/data/derby/test;create=true",
properties));
System.out.println(DriverManager.getConnection("jdbc:derby://localhost:1527/C:/data/derby/test;create=true",
properties));
> Driver.connect() returns null when using file-based URL
> -------------------------------------------------------
>
> Key: DERBY-6757
> URL: https://issues.apache.org/jira/browse/DERBY-6757
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 10.11.1.1
> Reporter: Lukas Eder
>
> The following program can be used to reproduce this issue:
> {code}
> import java.sql.Driver;
> import java.sql.DriverManager;
> import java.util.Properties;
> public class Test {
> public static void main(String[] args) throws Exception {
> Driver d = (Driver)
> Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
> Properties properties = new Properties();
> properties.setProperty("user", "TEST");
> properties.setProperty("password", "TEST");
>
> System.out.println(d.connect("jdbc:derby:C:/data/derby/test;create=true",
> properties));
>
> System.out.println(DriverManager.getConnection("jdbc:derby:C:/data/derby/test;create=true",
> properties));
> }
> }
> {code}
> When run, the above program will output something like:
> {monospace}
> null
> org.apache.derby.impl.jdbc.EmbedConnection@1226204845 (XID = 18681),
> (SESSIONID = 1), (DATABASE = C:/data/derby/test), (DRDAID = null)
> {monospace}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)