db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruta Kadhe <ruta.ka...@gmail.com>
Subject Embeded Database Creation
Date Fri, 18 Mar 2005 06:41:05 GMT
I am trying to create an Embedded Database. 
Firstly using DriverManager.getConnection() I specified create=true
and dataEncryption=true.
I created the Database Level Properties using this connection.
Then I committed the Connection.
Then I created new DB Connection where I specified bootPassword.
I exceuted the Table creation scripts using this connection.
The Database Creation is complete now.

However, I am not able to access the created Database then. I get
Invalid Authentication inspite of giving correct bootPassword, user
and password.
What could be wrong?
Please help !!
Thanks,
Ruta
Code snippet:
=========================================================================================
Properties sysProps = System.getProperties();
sysProps.put("derby.system.home", strDBPath);
String strBootPassword = "password";

Class.forName(CommonConstantsIF.DERBY_DRIVER).newInstance();

conn = DriverManager.getConnection(CommonConstantsIF.DERBY_PROTOCOL
				+ strDBname + ";create=true;dataEncryption=true;"
				+ "bootPassword=" + strBootPassword);
createUser(conn);
conn.commit();

// Actual Creation
Properties objProps = new Properties();
objProps.put("user", CommonConstantsIF.DB_USER);
objProps.put("password", strUserPassword);

//Create a normal connection
connUser = DriverManager.getConnection(
		CommonConstantsIF.DERBY_PROTOCOL
		+ strDBname	+ ";bootPassword=" + strBootPassword, objProps);
// Then I have code for actually creating statements and executing
them...........
connUser.commit();

=========================================================================================
The method createUser(Connection conn)
st = conn.createStatement();


// Setting and Confirming requireAuthentication
st.executeUpdate("CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY("
		+ "'derby.connection.requireAuthentication', 'true')");


// Setting authentication scheme to Cloudscape
st.executeUpdate("CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY("
		+ "'derby.authentication.provider', 'BUILTIN')");
String strUserPassword = "admin";

// Creating user
st.executeUpdate("CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY("
		+ "'derby.user." + CommonConstantsIF.DB_USER + " ', '"
		+ strUserPassword + "')");

// Setting default connection mode to no access
// (user authorization)
st.executeUpdate("CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY("
		+ "'derby.database.defaultConnectionMode', 'noAccess')");

//Defining read-write user
st.executeUpdate("CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY("
	+ "'derby.database.fullAccessUsers', '"
	+ CommonConstantsIF.DB_USER + "')");

//we would set the following property to TRUE only
//when we were ready to deploy.
st.executeUpdate("CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY("
		+ "'derby.database.propertiesOnly', 'false')");
=========================================================================================

Mime
View raw message