db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From legolas wood <legola...@gmail.com>
Subject Re: Obtaining JDBC connection using Derby embedded driver takes a long time...
Date Tue, 31 Oct 2006 19:58:25 GMT
Adam Kaoullas  , do you resolve the issue ?
I have the same problem and i am stocked with this.

thanks
> Yes it is normal. Imagine you are starting a whole
> database engine with that first connection and on top
> of that you are creating a brand new database when it
> is the first time:
>
> System.out.println("creating database");
> Connection conn =
> DriverManager.getConnection("jdbc:derby:c:/temp/Wombat2DB;create=true");
>
> Try "create database" command with any database server
> and it will take time. Bringing up any database server
> takes time too.
>
> After your database is created, if you pool your
> connections and cache prepared statements everything
> is fast with Derby.
>
> Regards,
> Ali
>
>
> --- "Kaoullas, Adamos D" <a.kaoullas@imperial.ac.uk>
> wrote:
>
> > Greetings all,
> >  
> > I am using Derby as an embedded database for an
> > application I am
> > developing. I am obtaining a JDBC connection using
> > the DriverManager
> > class. I am then using this connection to execute a
> > series of SQL
> > statements and thereby create my database tables. It
> > seems to take a
> > very long time to do this. It takes approximately 8
> > seconds to obtain
> > the connection, and  a further 8 seconds to execute
> > about 10 CREATE
> > table statements. Is this normal? I am using version
> > 10.0.2.1 on Windows
> > XP. I have a attached a test program I wrote to show
> > how I am starting
> > the database:
> >  
> > import java.sql.Connection;
> > import java.sql.DriverManager;
> > import java.sql.SQLException;
> > 
> > public class TestDerbyDB {
> > 	public static void main(String[] args) {
> > 		System.out.println("loading jdbc driver");
> > 		try {
> > 	
> >
> Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
> > 			System.out.println("JDBC driver loaded
> > succesfully");
> > 			System.out.println("creating database");
> > 			Connection conn = DriverManager
> > 	
> >
> .getConnection("jdbc:derby:c:/temp/Wombat2DB;create=true");
> > 			System.out.println("database created");
> > 		} catch (SQLException ex1) {
> > 			ex1.printStackTrace();
> > 		} catch (ClassNotFoundException ex) {
> > 			ex.printStackTrace();
> > 		}
> > 	}
> > }
> > 
> > Kind regards,
> > 
> > Adam Kaoullas
> > 

Mime
View raw message