[ 
https://issues.apache.org/jira/browse/DERBY-4907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12995454#comment-12995454
 ] 

Kathey Marsden commented on DERBY-4907:
---------------------------------------

For the white space issue, I have found in Eclipse that the setting Windows 
->Preferences -> General ->Editors -> Text Editors -> Show whitespace 
characters is very helpful to differentiate tabs and spaces.  Although they 
don't show with <right click> compare you can move the cursor in the white 
space to see the difference. Tabs will jump several spaces.

I think the patch is fine based on a cursory review.  I will let Tiago do the 
commit since he wants to take a look at it too.

I think you asked a couple important questions on IRC that I wanted to answer 
here. Maybe you answered them yourself as I don't see any such issues with the 
patch.

Q1) Shouldn't  shortDatabaseName do some checking on the validity of the 
database name format?  
I am not sure what checking would be required, but If there is any checking 
needed on the databaseName that should occur in setDatabaseName at the time 
that the user sets it, rather than in shortDatabaseName where it is just being 
parsed in the getConneciton() call.

Q2) Shouldn't errors print or be logged somewhere?
Because Derby is typically embedded in an application, the way we generally 
communicate problems to the application is by throwing an Exception.  That way 
the application can either  catch the exception and handle it or throw it back 
to the user if appropriate.  These can optionally be logged to the derby.log if 
the user wants by setting the derby.stream.error.logSeverity property 
http://db.apache.org/derby/manuals/tuning/perf90.html
If your work ever requires adding a new message for an exception, give the list 
a ping as there are some steps needed to make sure the message is localized, 
etc.
 
 




> EmbeddedXADataSource with ;create=true attribute set in setDatabaseName fails 
> with java.sql.SQLException: Database not available
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4907
>                 URL: https://issues.apache.org/jira/browse/DERBY-4907
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.1.3.1, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.3.0, 
> 10.6.2.1
>            Reporter: Kathey Marsden
>            Assignee: Siddharth Srivastava
>            Priority: Minor
>              Labels: derby_triage10_8
>         Attachments: derby4907.diff, derby4907.diff, derby4907.txt, 
> derby4907_final.diff
>
>
> Setting the ;create=true attribute in setDatabaseName with 
> EmbededXADataSource and EmbeddedXADataSource40  fails with 
> $ java TestDerbyCreate
> Exception in thread "main" java.sql.SQLException: Database not available
>         at 
> org.apache.derby.jdbc.EmbeddedXADataSource.setupResourceAdapter(Embe
> dedXADataSource.java:175)
>         at 
> org.apache.derby.jdbc.EmbeddedXADataSource.getXAConnection(EmbeddedX
> DataSource.java:101)
>         at TestDerbyCreate.main(TestDerbyCreate.java:18)
>       
> using the create attributie in databaseName works fine with 
> EmbeddedDataSource.  
> Using setCreateDatabase("create") with EmbeddedXADataSource is a good work 
> around and I think generally preferable.
> import java.sql.*;
> import javax.sql.*;
> public class TestDerbyCreate
> {
>     public static void main(String[] args) throws Throwable
>     {
>         org.apache.derby.jdbc.EmbeddedXADataSource ds =
>             new 
> org.apache.derby.jdbc.EmbeddedXADataSource();
>         ds.setDatabaseName("TestDB;create=true");
>         ds.setUser("dbuser1");
>         ds.setPassword("dbpwd1");
>       PooledConnection pooledConn = ds.getXAConnection();
>         Connection conn = pooledConn.getConnection();
>         System.out.println("Database product: " + 
> conn.getMetaData().getDatabaseProductName());
>         System.out.println("Database version: " + 
> conn.getMetaData().getDatabaseProductVersion());
>         System.out.println("Driver name:      " + 
> conn.getMetaData().getDriverName());
>         System.out.println("Driver version:   " + 
> conn.getMetaData().getDriverVersion());
>         System.out.println("JDBC driver major ve

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to