Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: What do I need for an ODBC connection to Oracle 9i with VC++?

Re: What do I need for an ODBC connection to Oracle 9i with VC++?

From: Roland Zenner <R_Zenner_at_yahoo.de>
Date: Tue, 22 Apr 2003 23:05:21 +0200
Message-ID: <b84aph$62bug$1@ID-190804.news.dfncis.de>


I've done it now...
Oracle itself has an OCCI - Oracle C++ Call Interface. You just have to know and look for the right keywords.

--
MfG
Roland Zenner

"Amit" <jindal_at_roguewave.com> schrieb im Newsbeitrag
news:d214e6c6.0304211408.34b6d374_at_posting.google.com...

> Try using SQLDriverConnect:
>
> const char* connStr =
> "DSN=ORACLE9;UID=scott;PWD=tiger;CONNECTSTRING=orcl";
> char outStr[1024];
> short outPtr = 0;
> retcode = SQLDriverConnect(dbch, NULL, (SQLCHAR*)connStr,
> strlen(connStr), (SQLCHAR*)outStr, 1024, &outPtr, SQL_DRIVER_NOPROMPT
> );
>
> I suspect the ODBC driver you is not able to resolve the correct
> Oracle connect string.
>
> Amit
> Development Engineer
> http://www.roguewave.com/products/sourcepro/db/
> [Disclaimer: All views expressed here are my personal views and they
> can be incorrect at times]
>
>
> "Roland Zenner" <R_Zenner_at_yahoo.de> wrote in message
news:<b81f6r$550u1$1_at_ID-190804.news.dfncis.de>...
> > I do get a connection with SQLPLUS, but not with ODBC...
> >
> > --
> > MfG
> > Roland Zenner
> > "Amit" <jindal_at_roguewave.com> schrieb im Newsbeitrag
> > news:b7nb0g$7k1$1_at_tux.cvo.roguewave.com...
> > > Try connecting through SQLPLUS first. That will establish correct
> > > connectivity before you attempt ODBC.
> > >
> > > - AMit
> > >
> > > "Roland Zenner" <zenner_at_iff.fhg.de> wrote in message
> > > news:3E9BFE8C.8C691BBC_at_iff.fhg.de...
> > > > Hello!
> > > >
> > > > I want to create a connection using ODBC and VC++.
> > > > What do I need and how can I do that?
> > > > This code does not work...
> > > > ret_code = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE,
> > > > &henv); // Environment-Handle holen (ODBC-Manager installiert?)
> > > > if ((ret_code==SQL_SUCCESS) || (ret_code==SQL_SUCCESS_WITH_INFO))
> > > > {
> > > > ret_code = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)
> > > > SQL_OV_ODBC3, SQL_NTS);
> > > > if ((ret_code==SQL_SUCCESS) || (ret_code==SQL_SUCCESS_WITH_INFO))
> > > > {
> > > > ret_code = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc); if
> > > > ((ret_code==SQL_SUCCESS) || (ret_code==SQL_SUCCESS_WITH_INFO))
> > > > {
> > > > ret_code = SQLConnect(hdbc, (SQLTCHAR*)dbname, SQL_NTS,
> > > > (SQLTCHAR*)name, SQL_NTS, (SQLTCHAR*)pw, SQL_NTS);
> > > > if ((ret_code==SQL_SUCCESS) || (ret_code==SQL_SUCCESS_WITH_INFO))
> > > > connection_flag=0L;
> > > >
> > > > Greetz
> > > > Roland
> > >
> > >
Received on Tue Apr 22 2003 - 16:05:21 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US