db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tiago R. Espinha (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4907) EmbeddedXADataSource with ;create=true attribute set in setDatabaseName fails with java.sql.SQLException: Database not available
Date Sun, 06 Mar 2011 12:21:10 GMT

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

Tiago R. Espinha commented on DERBY-4907:

Apologies for breaking the build :-( .

I hadn't set up the 1.4 JDK on my server and I also didn't pick this up on visual inspection.
Thank you Dave for the fixed patch. Since this is a really small change that maintains the
same functionality, I'm gonna go ahead and commit Dave's patch so that it makes it to the
10.8.1 release candidate.

@ Siddharth,

Due to backwards compatibility issues, we make sure that Derby's code complies with version
1.4 of the JDK. This means that certain features that were introduced in Java 1.5 and 1.6
can't be used, as they would break this compatibility with older JDKs. The method .contains()
is one of these features.

What you can do to ensure that your code is 1.4-compliant is download a 1.4 JDK and point
to it on the ant.properties file. For more information on how to do this, you can check the
BUILDING.html file in the root of Derby's SVN trunk.

In very general terms though, you need to create a file called ant.properties, put it on your
home directory, and make its contents look something like this: j14lib=/usr/local/bin/jdks/j2sdk1.4.2_19/jre/lib/

Then when you compile the code using 'ant all', it will automatically try to compile it against
the 1.4 JDK.

> 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:,,,,,
>            Reporter: Kathey Marsden
>            Assignee: Siddharth Srivastava
>            Priority: Minor
>              Labels: derby_triage10_8
>         Attachments: derby4907.diff, derby4907.diff, derby4907.diff, derby4907.diff,
derby4907.txt, derby4907_final.diff, derby4907_with_contains_fix.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


View raw message