db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "john miltone" <miltone.milt...@gmail.com>
Subject DriverManager.getConnection error with JDK 7
Date Sat, 23 Feb 2013 11:21:00 GMT
Hi All,

 

I am starting into Derby and I develop on Intellij IDEA with JDK 7.

I just want to create and start database. It seems very simple but the first
and unique code row generate a exception.

Can you help me to understand and arrive to start engine Derby database in
my program please ?

 

Here this is my code :

"

    public static void main (String[] args) throws IOException

    {

        String dbName = "MoneyBack1";

        String user = "miltone";

        String password = "password";

        String connectionURL = "jdbc:derby:" + dbName + ";create=true;user="
+ user + ";password=" + password ;

        String createString = "CREATE TABLE operation " + "(operation_ID INT
NOT NULL GENERATED ALWAYS AS IDENTITY " + " type VARCHAR(32) NOT NULL) " ;

 

        try

        {

            Connection connexion =
DriverManager.getConnection(connectionURL);

            Statement statement = connexion.createStatement();

            statement.executeQuery(createString);

            statement.close();

            connexion.close();

        }

        catch (Throwable e)

        {

            System.out.println("1");

        }

"

 

DriverManager.getConnection throw a exeception always.

I'm using JDK 1.7.0_10 so then I don't use ClassName methods for bring
driver into memory.

 

Thank a lot for all helping.


Mime
View raw message