Hello
Could someone tell me what derby requiers to make this conn?

public boolean createDatabase() throws FileNotFoundException, 

IOException {
        boolean createdDb = false;
        Connection conn = null;
        String dbURL = getDbURL();
        String user = ModelUtils.getXMLResource("user");
        String password = ModelUtils.getXMLResource("password");
        System.out.println("in CreateDatabase:try:dbURL FROM XML 

properties: " + dbURL);
        System.out.println("in CreateDatabase:try:dbURL FROM XML 

properties: " + user);
        System.out.println("in CreateDatabase:try:dbURL FROM XML 

properties: " + password);
        try {


            [b]conn = DriverManager.getConnection(dbURL, 

dbProperties);[/b]


            System.out.println("got conn?: " + conn.toString());
            createdDb = createTables(conn);
            System.out.println("tables created: " + createdDb);
            dbProperties.put("createdDb", "true");
            System.out.println("in CreateDatabase:added new 

property?: " + dbProperties.getProperty("createdDb"));
        } catch (SQLException ex) {
        }

        System.out.println("tables created: " + createdDb);
        System.out.println("DataBase Created: " + createdDb);
        dbProperties.remove("createdDb");
        return createdDb;
    }

output

run:
driver name from xml: org.apache.derby.jdbc.EmbeddedDriver
in CreateDatabase:try:dbURL FROM XML properties: 

jdbc:derby:schoolofdb
in CreateDatabase:try:dbURL FROM XML properties: root
in CreateDatabase:try:dbURL FROM XML properties: ceyesuma
tables created: false
DataBase Created: false

Uhm, create=true as part of the DB url, maybe? Can't say if that's case since you haven't shown us what you used, nor told us in what state the DB was in before you started.

Hello
Could someone tell me what derby requiers to make this conn?
This Class creates brand new derby database if it gets a connection.
I didn't see a reference implying create=true as part of the DB url. I'm not sure where

you are seeing this.
dbURl
dbURL FROM XML properties: jdbc:derby:schoolofdb
dbURl

public boolean createDatabase() throws FileNotFoundException,  IOException {
        boolean createdDb = false;
        Connection conn = null;
        String dbURL = getDbURL();
        String user = ModelUtils.getXMLResource("user");
        String password = ModelUtils.getXMLResource("password");
        System.out.println("dbURL FROM XML  properties: " + dbURL);
        System.out.println("user FROM XML  properties: " + user);
        System.out.println("password FROM XML  properties: " + password);
        try {
            conn = DriverManager.getConnection(dbURL,  dbProperties);
            System.out.println("got conn?: " + conn.toString());
             [b]never enters this method 
             because something is wrong with the parameters 
              to get connection[/b]
            createdDb = createTables(conn);
            System.out.println("tables created: " + createdDb);
            dbProperties.put("createdDb", "true");
            System.out.println("boolen"+ dbProperties.getProperty("createdDb"));
        } catch (SQLException ex) {
        }

        System.out.println("tables created: " + createdDb);
        System.out.println("DataBase Created: " + createdDb);
        dbProperties.remove("createdDb");
        return createdDb;
    }

output

run:
driver name from xml: org.apache.derby.jdbc.EmbeddedDriver

[b]dbURl[/b]
dbURL FROM XML properties:jdbc:derby:schoolofdb
[b]dbURl[/b]
user FROM XML properties: root
password FROM XML properties: ceyesuma
tables created: false
DataBase Created: false

then try adding ";create=true" to the end of the dburl. See the documentation (as I believe I've already said). Its not "entering that method" as you say because the connection is failing (possibly becuase the db doesn't exist, which I assume is the case since you're wanting to create tables), and you would be able to "see" that if you didn't simply ignore the exceptions like you are. Never do that. At the very least print the stack traces to STDERR.

Thanks that is some good info I understand now. I have to take get better with the exceptions I know.
Further, I actually already had the conn in the class, and I setConn() to. so i was shooting myself in the foot. because
conn=getConn() was sufficient.

Now it is off to the creation of tables.
thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.