|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
How do I disable foreign keys from the jdbc url? does hsqldb support md5() like mysql does?Hi! Also, does hsqldb support md5() like mysql does? I'm trying to get cross-database tests working on both databases... but not having this method causes some tests to fail. Thanks!
Ken -- Brand New Song! Listen NOW! http://dl.getdropbox.com/u/443421/Ken_Egervari_-_When_It_Rains.mp3 My Original Music: http://www.soundclick.com/KenEgervari My Humorous Speeches: http://www.youtube.com/user/egervari My Facebook: http://www.new.facebook.com/profile.php?id=716270499/profile.php?id=716270499 ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Hsqldb-user mailing list Hsqldb-user@... https://lists.sourceforge.net/lists/listinfo/hsqldb-user |
|
|
Re: How do I disable foreign keys from the jdbc url? doeshsqldb support md5() like mysql does?Referring to 1.9
This is an SQL command SET DATABASE REFERENTIAL INTEGRITY
{FALSE | TRUE}
With 1.9 we may be able to allow this as a url property.
There is an MD5 implementation in the 1.9 jar in the
org.hsqldb.lib package. You can define a function name for this function
using
CREATE FUNCTION ... syntax for a Java method.
Fred
------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Hsqldb-user mailing list Hsqldb-user@... https://lists.sourceforge.net/lists/listinfo/hsqldb-user |
|
|
Re: How do I disable foreign keys from the jdbc url? doeshsqldb support md5() like mysql does?Hi Fred, It would be AMAZING if you could provide a quick shortcut in the jdbc url for disabling these, just to make code work consistency for people using mysql and hsqldb on the same project. I love hsqldb for testing because the test speeds SCREAM compared to using an actual database ;) Hsqldb rocks.
I have tried calling SET DATABASE REFERENTIAL INTEGRITY FALSE through jdbc manually before Dbunit does it's thing... but then the connection pooling starts failing unless I give it more connections. When I set it to 100 (default settings from various spring projects), the database eventually cannot connect. So I have to set it to 250 or so to get 650 or so tests to pass all at once.
This is the code I used. DataSourceUtils gets an apache commons dcp datasource, and inside of this object is the basic JDBC Connection object (hence the connection.getConnection()....) public IDatabaseConnection getDatabaseConnection() throws DatabaseUnitException { IDatabaseConnection connection =
new DatabaseConnection( DataSourceUtils.getConnection( dataSource ) ); try {
Statement s = connection.getConnection().createStatement(); s.execute( "SET REFERENTIAL_INTEGRITY FALSE;" );
s.close(); } catch( SQLException e ) { throw new RuntimeException( e );
} DatabaseConfig config = connection.getConfig(); config.setProperty( DatabaseConfig.PROPERTY_DATATYPE_FACTORY,
new HsqldbDataTypeFactory() ); return connection; }
1. Is there any way I can get a maven pre-release of 1.9 and start using that if that query property is added so I can start using it? 2. Is there any way to fix the code above so that I don't need to set 250 connections in the pool for the tests to work?
Thanks Fred! Ken -- Brand New Song! Listen NOW! http://dl.getdropbox.com/u/443421/Ken_Egervari_-_When_It_Rains.mp3 My Original Music: http://www.soundclick.com/KenEgervari My Humorous Speeches: http://www.youtube.com/user/egervari My Facebook: http://www.new.facebook.com/profile.php?id=716270499/profile.php?id=716270499 On Thu, Oct 1, 2009 at 10:20 AM, fredt <fredt@...> wrote:
------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Hsqldb-user mailing list Hsqldb-user@... https://lists.sourceforge.net/lists/listinfo/hsqldb-user |
|
|
Re: How do I disable foreign keys from the jdbc url? doeshsqldb support md5() like mysql does?I forgot to add:
Version 1.9 has been improved for testing scenarios to allow
environment constants and data to be defined and saved in a boilerplate
database.
A database can be prepared with all the settings and
predefined tables and data. This database is then opened with the
files_readonly=true property on the URL (or the property is saved in the
.properties file). Schema and data change is allowed in the database (no cached
tables though) during tests, but nothing is written to disk.
Fred
------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Hsqldb-user mailing list Hsqldb-user@... https://lists.sourceforge.net/lists/listinfo/hsqldb-user |
|
|
Re: How do I disable foreign keys from the jdbc url? doeshsqldb support md5() like mysql does?Wow... so there would be no need for dbunit then perhaps? ;) (Ken does not like dbunit and wishes there were better options available) Ken -- Brand New Song! Listen NOW! http://dl.getdropbox.com/u/443421/Ken_Egervari_-_When_It_Rains.mp3 My Original Music: http://www.soundclick.com/KenEgervari My Humorous Speeches: http://www.youtube.com/user/egervari My Facebook: http://www.new.facebook.com/profile.php?id=716270499/profile.php?id=716270499 On Thu, Oct 1, 2009 at 10:36 AM, fredt <fredt@...> wrote:
------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Hsqldb-user mailing list Hsqldb-user@... https://lists.sourceforge.net/lists/listinfo/hsqldb-user |
|
|
Re: How do I disable foreign keys from the jdbc url?doeshsqldb support md5() like mysql does?The requirements for connections seems strange. I invite
others to comment on this. You should also ask Dbunit if you don't get a
response here.
If you are using a Server instance, when lots of connections
are made to the server, it is the TCP/IP stack on machine that fails to create
new sockets, not the database server refusing connections.
I've added the url property request to my list and it will be
added before GA release.
Will make 1.9 available via MAVEN when it is
released.
Fred
------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Hsqldb-user mailing list Hsqldb-user@... https://lists.sourceforge.net/lists/listinfo/hsqldb-user |
|
|
Re: How do I disable foreign keys from the jdbc url?doeshsqldb support md5() like mysql does?Sweet Fred! That's excellent news. I can't wait until 1.9 goes GA. I'm very excited! I did manage to figure out what was going on with the connections. It would appear that calling getConnection() on dbunit's wrapper actually instantiates a new connection every time and doesn't reuse an existing one. So calling getConnection() to do anything kept making new connections. Ugh...
So, the solution was to put it in a temporary variable to avoid the side effects. Here's dbunit code that works for both mysql and hsqldb, and also avoids the connection problems (if anyone else needs it).
public IDatabaseConnection getDatabaseConnection() throws DatabaseUnitException { Connection sqlConnection = DataSourceUtils.getConnection( dataSource );
IDatabaseConnection databaseConnection = new DatabaseConnection( sqlConnection );
try { DatabaseConfig config = databaseConnection.getConfig();
if( "HSQL Database Engine".equals( sqlConnection.getMetaData().getDatabaseProductName() ) )
{ Statement statement = sqlConnection.createStatement(); statement.execute( "SET REFERENTIAL_INTEGRITY FALSE;" );
statement.close(); config.setProperty( DatabaseConfig.PROPERTY_DATATYPE_FACTORY,
new HsqldbDataTypeFactory() ); } else { config.setProperty( DatabaseConfig.PROPERTY_DATATYPE_FACTORY,
new MySqlDataTypeFactory() ); } } catch( SQLException e ) {
throw new RuntimeException( e ); } return databaseConnection;
} Thanks Fred for all of your help! I can't wait until 1.9 GA ;) Ken -- Brand New Song! Listen NOW! http://dl.getdropbox.com/u/443421/Ken_Egervari_-_When_It_Rains.mp3 My Original Music: http://www.soundclick.com/KenEgervari My Humorous Speeches: http://www.youtube.com/user/egervari My Facebook: http://www.new.facebook.com/profile.php?id=716270499/profile.php?id=716270499 On Thu, Oct 1, 2009 at 10:43 AM, fredt <fredt@...> wrote:
------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Hsqldb-user mailing list Hsqldb-user@... https://lists.sourceforge.net/lists/listinfo/hsqldb-user |
|
|
Re: How do I disable foreign keys from the jdbc url? doeshsqldb support md5() like mysql does?Hi Fred, Also solved the md5 issue temporarily with this code: statement = sqlConnection.createStatement(); statement.execute( "CREATE ALIAS MD5 FOR \"org.apache.commons.codec.digest.DigestUtils.md5Hex\"" );
statement.close(); So now I'm good to go. The database test base class is a little bloated, and I fix that when 1.9 becomes available. Thanks for your help!
Ken -- Brand New Song! Listen NOW! http://dl.getdropbox.com/u/443421/Ken_Egervari_-_When_It_Rains.mp3 My Original Music: http://www.soundclick.com/KenEgervari My Humorous Speeches: http://www.youtube.com/user/egervari My Facebook: http://www.new.facebook.com/profile.php?id=716270499/profile.php?id=716270499 On Thu, Oct 1, 2009 at 10:20 AM, fredt <fredt@...> wrote:
------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Hsqldb-user mailing list Hsqldb-user@... https://lists.sourceforge.net/lists/listinfo/hsqldb-user |
| Free embeddable forum powered by Nabble | Forum Help |