[Building Sakai] Updating SQL database directly

Mark J. Norton markjnorton at earthlink.net
Wed Jan 30 06:25:07 PST 2013


The UserDirectoryService is part of the Sakai kernel.  Download this 
from SVN: https://source.sakaiproject.org/svn/kernel/tags/kernel-1.1.0/ 
(or whatever version you are running)

Cd into that directory and run "mvn javadoc:javadoc".  The JavaDoc 
results will be located in kernel-1.1.0/target/site/apidocs.  Load the 
index.htm file into a browser and you'll have all the technical 
documentation you need to make this work.

- Mark Norton


On 1/30/2013 9:10 AM, Nguni Phakela wrote:
> Thank you Mark. I wasn't sure if there was another approach to this. I 
> will try that.
>
> Cheers,
> Nguni
>
>
> On Wed, Jan 30, 2013 at 3:56 PM, Mark J. Norton 
> <markjnorton at earthlink.net <mailto:markjnorton at earthlink.net>> wrote:
>
>     Why do this with a direct database operations?  This is what the
>     User service is supposed to handle.  Get an instance of the
>     UserDirectoryService, get a UserEdit instance for the user id. 
>     Set the EID and commit it.
>
>     - Mark Norton
>
>
>     On 1/30/2013 4:02 AM, Nguni Phakela wrote:
>>     Hi,
>>
>>     I have the following code to update a table:
>>
>>     conn = dataSource.getConnection();
>>     String updateString = "update SAKAI_USER_ID_MAP set EID = ?
>>      where USER_ID = ?";
>>     PreparedStatement updateOptions =
>>     conn.prepareStatement(updateString);
>>
>>     System.out.println(updateOptions.toString());
>>
>>     updateOptions.setString(1, studentNumber);
>>     updateOptions.setString(2, user.getId());
>>
>>     System.out.println(updateOptions.toString());
>>
>>     int rowsUpdated = updateOptions.executeUpdate();
>>
>>     System.out.println("Number of rows updated: " + rowsUpdated);
>>
>>
>>     I'm getting the following output:
>>     com.mysql.jdbc.JDBC4PreparedStatement at 77c03963: update
>>     SAKAI_USER_ID_MAP set EID = ** NOT SPECIFIED **  where USER_ID =
>>     ** NOT SPECIFIED **
>>     com.mysql.jdbc.JDBC4PreparedStatement at 77c03963: update
>>     SAKAI_USER_ID_MAP set EID = 'xxxxxx'  where USER_ID =
>>     'xxxxxxxxx-d0fb-4824-aa45-f65e5ecad515'
>>
>>     The executeUpdate() seems to not be executing, and the printout
>>     for the number of rows updated
>>     also seems to not be executing.
>>
>>     What could I be missing?
>>
>>     Cheers
>>
>>     -- 
>>     Nguni Phakela
>>
>>
>>     _______________________________________________
>>     sakai-dev mailing list
>>     sakai-dev at collab.sakaiproject.org  <mailto:sakai-dev at collab.sakaiproject.org>
>>     http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>
>>     TO UNSUBSCRIBE: send email tosakai-dev-unsubscribe at collab.sakaiproject.org  <mailto:sakai-dev-unsubscribe at collab.sakaiproject.org>  with a subject of "unsubscribe"
>
>
>     _______________________________________________
>     sakai-dev mailing list
>     sakai-dev at collab.sakaiproject.org
>     <mailto:sakai-dev at collab.sakaiproject.org>
>     http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
>     TO UNSUBSCRIBE: send email to
>     sakai-dev-unsubscribe at collab.sakaiproject.org
>     <mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a
>     subject of "unsubscribe"
>
>
>
>
> -- 
> Nguni Phakela

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20130130/e0d7ee8e/attachment.html 


More information about the sakai-dev mailing list