OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

SOLVED Calling stored procedures from Base

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
pfandler
General User
General User


Joined: 09 Jan 2006
Posts: 7

PostPosted: Thu May 17, 2007 12:32 am    Post subject: SOLVED Calling stored procedures from Base Reply with quote

Hello,

I want to call a MySQL stored procedure from OObasic (OO version 2.2).

When I call the function prepareCall(<sql statement>) then I get the following exception:

BASIC runtime error.
An exception occured
Type: com.sun.star.sdbc.SQLException
Message: XConnection::prepareCall: feature not implemented..

How can I call a stored procedure if the call is NOT IMPLEMENTED????


Last edited by pfandler on Sun May 20, 2007 9:54 pm; edited 1 time in total
Back to top
View user's profile Send private message
DrewJensen
Super User
Super User


Joined: 06 Jul 2005
Posts: 2616
Location: Cumberland, MD

PostPosted: Thu May 17, 2007 7:35 pm    Post subject: Reply with quote

I just use call, not prepare call. MySQL 5 and jdbc 5.0.3
_________________
Blog - http://baseanswers.spaces.live.com/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pfandler
General User
General User


Joined: 09 Jan 2006
Posts: 7

PostPosted: Sat May 19, 2007 12:33 am    Post subject: Reply with quote

Thanks Drew, I will try with the newer version of ODBC. Now I use version 3
Back to top
View user's profile Send private message
pfandler
General User
General User


Joined: 09 Jan 2006
Posts: 7

PostPosted: Sun May 20, 2007 9:53 pm    Post subject: SOLUTION Reply with quote

MySQL ODBC Connector V5 beta supports calling stored procedures.

It works this way:

Code:

   dbpath="file:///C:/path/to/openoffice_database.odb"
   DatabaseContext = createUnoService("com.sun.star.sdb.DatabaseContext")
   oDataSource = DatabaseContext.getByName(dbpath)
   if not oDataSource.isPasswordRequired then
      oConnection = oDataSource.getConnection("username","password")
      MsgBox "The database was opened: " & dbpath
   else
      MsgBox "Please log in to the database"
      oHandler = createUnoService("com.sun.star.sdb.InteractionHandler")
      oConnection = oDataSource.connectWithCompletion(oHandler)
   end if
   q1 = "call stored_procedure(" & paramstring & ");"
   oConnection_m = oDataSource.getConnection("username","password")
   oStatement_m = oConnection_m.CreateStatement
   oResultSet_m = oStatement_m.executeQuery(q1)


The openoffice ODB file is created using a predefined MySQL ODBC v5 datasource.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group