Topic
3 replies Latest Post - ‏2007-06-27T18:50:00Z by SystemAdmin
SystemAdmin
SystemAdmin
1525 Posts
ACCEPTED ANSWER

Pinned topic How to get INSERT rights for embedded cloudscape database?

‏2007-06-27T12:56:39Z |
"An SQL data change is not permitted for a read-only connection, user or database."

Hi,

I get the above error message when I try to INSERT a record in an embedded cloudscape database.

I have IBM RAD IDE.
I have embedded cloudscape DB under a sub-folder "DB".

This is how I loaded the driver.

**********************************************************************
Class.forName("com.ibm.db2j.jdbc.DB2jDriver");
connection dbConnection = DriverManager.getConnection("jdbc:db2j:/DB/MYLIB", "APP", "APP");
**********************************************************************

The following select statement works fine. So Iam sure its talking to the database.

**************************************************************************
ResultSet rs = statement.executeQuery("SELECT MAX(LIN) FROM LIBRARYITEM");
**************************************************************************

But when I try to INSERT I get SQLException

**************************************************************************
Statement stmt = dbConnection.createStatement();
stmt.executeUpdate(insertItemSQL);
**************************************************************************

Message from SQLException:
"An SQL data change is not permitted for a read-only connection, user or database."

Please tell me what Iam doing wrong.

The following is my db2j.properties file contents

*********************************************
db2j.drda.logConnections=true
db2j.drda.maxThreads=0
db2j.drda.portNumber=1527
db2j.drda.traceAll=true
db2j.drda.loadSYSIBM=true
db2j.drda.timeSlice=0
db2j.drda.traceDirectory=/trace
db2j.drda.sendLongVarcharAsClob=false
db2j.drda.sendLongBitVaryingAsBlob=false
db2j.connection.requireAuthentication=true
db2j.authentication.provider=BUILTIN
#db2j.database.propertiesOnly=false
db2j.database.defaultConnectionMode=fullAccess
db2j.user.sa=test123
db2j.user.APP=APP
db2j.database.fullAccessUsers=APP
*********************************************

The above property file is in the location
C:\Program Files\IBM\Rational\SDP\6.0\runtimes\base_v6\cloudscape
Updated on 2007-06-27T18:50:00Z at 2007-06-27T18:50:00Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    1525 Posts
    ACCEPTED ANSWER

    Re: How to get INSERT rights for embedded cloudscape database?

    ‏2007-06-27T13:30:10Z  in response to SystemAdmin
    I renamed the db2j.properties file and still I got the same error message.

    Can anyone tell how to make sure my code is reading the db2j.properties file.
    I have a suspicion that maybe the db2j.properties file is not read !
  • Stan
    Stan
    267 Posts
    ACCEPTED ANSWER

    Re: How to get INSERT rights for embedded cloudscape database?

    ‏2007-06-27T18:00:59Z  in response to SystemAdmin
    Hi -

    This problem will occur when Cloudscape does not have permissions to write to one of the it's files, often the cloudscape.log file. Check to be sure that the Cloudscape process has read and write permissions to the database directory tree and files as well as to the cloudscape. system.home directory.

    The most obvious way I have found to verifty that the properties file is being read is to set logStatementText, start the database and issue a single query. If the query appears in the cloudscape.log file then the property was picked up.

    HTH
    • SystemAdmin
      SystemAdmin
      1525 Posts
      ACCEPTED ANSWER

      Re: How to get INSERT rights for embedded cloudscape database?

      ‏2007-06-27T18:50:00Z  in response to Stan
      Hi,

      Can you please let me know how to check if Cloudscape has read and write permission to the database directory tree and system home directory