Executing Stored Procedures with ODBC.

Executing Stored Procedures with ODBC.

Post by Cameron 'Roon' McK » Fri, 03 Mar 1995 21:21:03



How can I execute a stored procedure on the backend database using an
MS Access pass through query and ODBC?

I am using Access 2.0 which is not a supported Ingres ODBC product but it
seems to work OK with most things.  When I attempt to do the above, I get
an Ingres ODBC read only error.

Any help would be appreciated.

Cameron

 
 
 

Executing Stored Procedures with ODBC.

Post by MDKa » Sat, 04 Mar 1995 12:05:46



How can I execute a stored procedure on the backend database using an
MS Access pass through query and ODBC?

I am using Access 2.0 which is not a supported Ingres ODBC product but it
seems to work OK with most things.  When I attempt to do the above, I get
an Ingres ODBC read only error.

Any help would be appreciated.

Cameron

===============================

I have a table called sy_trigger with 10 integer columns and 10 varchar
columns a db_proc column, usr_id, and timestamp.  I then have rules on
insert on the table which check the db_proc value and call the appropriate
procedure.  It has worked very well, and as a bonus you get a trace of all
procedure calls, who & when.

Hope this helps,

Mark Kale
York & Associates, Inc.

Mark Kale
York & Associates, Inc.
(V) 612-831-0077

 
 
 

1. Executing stored procedures via ODBC

I'm having a problem executing a stored procedures via ODBC.  I'm certain
the stored procedure is being invoked, however, my input and output
parameters are being passed back and forth. I use SQLBindParameter function
for the mapping (see below). Any Ideas why this wouldn't work?

Thanks for your help,
 Massis

 virtual UERROR open(
  void*&        pVoid,   // returned file identifier for future I/O calls,
implementation defines contents
  const char*   pName,   // name of file to open
  IORESULTCODE& nResultCode)  // return codes:
          //  IORC_THEN  - file opened ok
          //  IORC_ELSE  - file not found
          //  IORC_ERROR - IO failed for some other reason.
 {
  char   errmsg[1024];

  char   sqlStmt[] = "{call MVOpen(?, ?)}";
  SQLHSTMT  hstmt;
  char   fileptr[256];

  long   nNameLen = 0;
  long   nResultLen = 0;
  long   nFilePtrLen = 0;
  long   nClassNameLen = 0;

  int    rcode = 0;

  // obtain statement handle to execute stored procedure

  rcode = SQLAllocHandle(SQL_HANDLE_STMT, m_db->hdbc1(), &hstmt);

  rcode = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR,
SQL_VARCHAR,
    strlen(pName), 0, (void *) pName, 0, &nNameLen);

  rcode = SQLBindParameter(hstmt, 2, SQL_PARAM_OUTPUT, SQL_C_CHAR,
SQL_VARCHAR,
    sizeof(fileptr), 0, fileptr, 0, &nFilePtrLen);

  // Execute the statement.

  rcode = SQLExecDirect(hstmt, (unsigned char *) sqlStmt, SQL_NTS);
  ProcessLogMessages(SQL_HANDLE_STMT, hstmt, errmsg, true);

  rcode = SQLFetch(hstmt);
  ProcessLogMessages(SQL_HANDLE_STMT, hstmt, errmsg, true);

  SQLFreeHandle(SQL_HANDLE_STMT, hstmt);

  nResultCode = IORC_ON_ERROR;
  return UE_NOERROR;
 }

2. Variable parameter types - dB structure

3. Problem executing stored procedure with ODBC

4. Unique member names

5. sql2ksp3 upgrade: Error executing stored procedure via ODBC

6. Using a separate numeric quarter and year to delimit a question

7. VB execute stored procedure via ODBC to SQL SVR 7.0

8. Performance of dedicated server!

9. Empty output parameters when executing stored procedure through ODBC

10. Executing stored procedures via ODBC

11. Executing a Stored Procedure in a Stored Procedure and selecting on the result

12. executing system stored procedures within a stored procedure

13. Executing stored procedure from another stored procedure.