Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

it seem have a little question at SecurityCommon -> executeAddRole()

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try {
if (supportAutoGeneratedKeys) {
p = JForumExecutionContext.getConnection().prepareStatement(sql,
Statement.RETURN_GENERATED_KEYS);
} else {
p = JForumExecutionContext.getConnection().prepareStatement(sql);
}

p.setInt(1, id);
p.setString(2, role.getName());

// there no the third parameter values!!!

p.executeUpdate();

if (roleValues != null) {
int roleId = -1;

if (supportAutoGeneratedKeys) {
rs = p.getGeneratedKeys();
rs.next();
roleId = rs.getInt(1);
} else {
p = JForumExecutionContext.getConnection().prepareStatement(
autoKeysQuery);
rs = p.executeQuery();
if (rs.next()) {
roleId = rs.getInt(1);
}
}
rs.close();
rs = null;
p.close();
p = null;

if (roleId == -1) {
throw new SQLException("Could not obtain the latest role id");
}

p = JForumExecutionContext.getConnection().prepareStatement(
SystemGlobals.getSql("PermissionControl.addRoleValues"));

for (Iterator iter = roleValues.iterator(); iter.hasNext(); ) {
RoleValue rv = (RoleValue) iter.next();

p.setInt(1, roleId);
p.setString(2, rv.getValue());

p.executeUpdate(); // when debug here throw err !!
}
}
} catch (SQLException e) {
throw new DatabaseException(e);
} finally {
DbUtils.close(rs, p);
}

the sql have three parameter but before p.executeUpdate(); only set two parameter

:
INSERT INTO jforum_roles (role_id, group_id, name, role_type ) VALUES (jforum_roles_seq.nextval, ?, ?, ?)

p.setInt(1, id);
p.setString(2, role.getName());




[originally posted on jforum.net by jyhcyd]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which version of SecurityCommon you use?

There is version of SecurityCommon for 2.1.5/2.1.6 jforum
https://jforum.dev.java.net/source/browse/jforum/src/net/jforum/dao/generic/security/SecurityCommon.java?rev=1.5&view=markup


[originally posted on jforum.net by Serge Maslyukov]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i use the file SecurityCommon which i get from CVS today

SecurityCommon.java edition 1.11 Fir Aug 25 01:04:36 2006


[originally posted on jforum.net by jyhcyd]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i use Oracle9i whether Jforum not sustain Oracle ??
[originally posted on jforum.net by jyhcyd]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, we changed the security code, but I forgot to update some sql scripts.

Try fetching from the cvs again.. it should be fixed now.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks!!
[originally posted on jforum.net by jyhcyd]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic