|
I tried this by removing the space separator in the call to nextToken method in tokenizeDatabase method in ClientDriver.java. With this change, I am able to create and connect to a database with spaces in its name. I tried few simple operations like creates, inserts and selects with the database.
Trejkaz mentions a getting a disconnect exception when trying some operation with such a database. From the stack trace, it looks like Trejkaz was getting an exception in the call to DatabaseMetaData.getTables. I tried this in a small repro and did not get any exception with my patch. Anyone has any idea what exactly was being done to get the stack trace above ? Attaching a patch 'derby-618-v1.diff'. This is a one line change in ClientDriver.java. It removes the space separator in the call to nextToken method in tokenizeDatabase method. This allows use of database names with spaces.
With this patch, I can create and connect to databases with spaces in the path or name. After connecting to such a database, I tried few simple operations. I did not get any exceptions. I think Trejkaz was getting an exception because previously network server also did not support database name with spaces. The problem at network server was resolved as part of I have not added any new regression test for this patch since we will be able to run the test only on Windows. I think test harness does not allow excluding tests based on an operating system. I have repros to test this and I'll upload them shortly. With the patch, I have run derbynetclientmats using Sun JDK 1.4.2 on Windows XP. No failures. I would appreciate if someone can take a look at this patch. Ataching repros to test the patch:
1. repro1: derby-618.java - This is a simple java program which creates and connects to a database with spaces in path. And then does some operations on the database. 2. repro2: derby-618-script.sql - This is an ij script. To run the repros: 1. Start network server on port 2222. 2. For repro1, run the command 'java derby-618'. 3. For repro 2, start ij and run the script 'derby-618-script.sql'. ----------------------------------- Without the patch: ----------------------------------- The repros will not give any exception when run without the patch. They will just create the wrong databases: * repro1 will create a database 'C:\directory' * repro2 will create a database 'test' ----------------------------------- With the patch: ----------------------------------- Repros should create the correct databases with spaces: * repro1 will create 'C:\directory with spaces\db name with spaces' * repro2 will create 'test db with spaces' Thanks for pointing this out. I think I can add a test to jdbcapi/checkDriver.java for an url with spaces in the database name. I had this wrong notion in my head that directory names with spaces apply only to Windows and hence not added a regression test. I see that other platforms allow creation of directory names with spaces, just that in some situations, it is recommended to avoid this. I will add this test and upload the new patch in a while.
Attaching a patch 'derby-618-v2.diff' which includes code change and a test for this issue. Patch does the following:
* Modifies ClientDriver.java - removes the space separator in the call to nextToken in tokenizeDatabase method. This allows use of URL containing database name with spaces. * Adds tests to jdbcapi/checkDriver.java for an url with spaces in database name. Since embedded and jcc driver work with spaces, I added this test for all three frameworks. Test verfies that the specified database gets created. * Modifies master files for the test Ran derbyall with Sun JDK 1.4.2 on Windows XP. I also ran jdbcapi/checkDriver.java with j9 vms. Please take a look at this patch. Thanks. Checked this change into trunk but leaving opena and changing fixin to 10.1.2.3
Date: Fri Mar 3 11:51:46 2006 New Revision: 382917 URL: http://svn.apache.org/viewcvs?rev=382917&view=rev Attaching a patch 'derby-618-10.1.diff' for 10.1 branch. Submiiting a patch because revision #382917 could not be merged directly using svn merge command. This patch requires the changes in
Changes to resove the merge conflicts: * * With both the patches applied, I ran the following tests: * derbyall with sane jars using Sun JDK 1.4.2. One failure in unit/T_Diagnosticable.unit. This test is failing with sane jars. It does not fail with sane classes. The test fails with sane jars even without the patches. The failure is same as what is reported in * jdbcapi/checkDriver.java with j9 vms. NOTE: This patch has to be committed together with the 10.1 branch patch for Checked into 10.1.2.4
'Date: Thu Mar 9 10:51:21 2006 New Revision: 384581 URL: http://svn.apache.org/viewcvs?rev=384581&view=rev Something had gone wrong in the update of the j9_13/checkDriver.out, username and password had gotten reversed. Updated master/canon with:
http://svn.apache.org/viewvc?view=rev&revision=477004 This issue has been resolved for over a year with no further movement. Closing.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Caused by: org.apache.derby.client.am.DisconnectException: A communication error has been detected. Communication protocol being used: Reply.fill(). Communication API being used: InputStream.read(). Location wh
ere the error was detected: insufficient data. Communication function detecting the error: *. Protocol specific error codes(s) TCP/IP SOCKETS
at org.apache.derby.client.net.NetAgent.throwCommunicationsFailure(NetAgent.java:362)
at org.apache.derby.client.net.Reply.fill(Reply.java:193)
at org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Reply.java:212)
at org.apache.derby.client.net.Reply.ensureBLayerDataInBuffer(Reply.java:225)
at org.apache.derby.client.net.NetStatementReply.parsePKGNAMCSN(NetStatementReply.java:1478)
at org.apache.derby.client.net.NetStatementReply.parsePKGSNLST(NetStatementReply.java:1721)
at org.apache.derby.client.net.NetStatementReply.parseRSLSETRM(NetStatementReply.java:1080)
at org.apache.derby.client.net.NetStatementReply.parseResultSetProcedure(NetStatementReply.java:343)
at org.apache.derby.client.net.NetStatementReply.parseEXCSQLSTTreply(NetStatementReply.java:279)
at org.apache.derby.client.net.NetStatementReply.readExecuteCall(NetStatementReply.java:97)
at org.apache.derby.client.net.StatementReply.readExecuteCall(StatementReply.java:74)
at org.apache.derby.client.net.NetStatement.readExecuteCall_(NetStatement.java:174)
at org.apache.derby.client.am.Statement.readExecuteCall(Statement.java:1105)
at org.apache.derby.client.am.PreparedStatement.flowExecute(PreparedStatement.java:1426)
at org.apache.derby.client.am.PreparedStatement.executeQueryX(PreparedStatement.java:299)
at org.apache.derby.client.am.DatabaseMetaData.executeCatalogQuery(DatabaseMetaData.java:1767)
at org.apache.derby.client.am.DatabaseMetaData.getTablesX(DatabaseMetaData.java:1148)
at org.apache.derby.client.am.DatabaseMetaData.getTables(DatabaseMetaData.java:1101)
at com.nuix.store.database.AbstractDatabase.tableExists(AbstractDatabase.java:189)
... 12 more