Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: What do I need for an ODBC connection to Oracle 9i with VC++?
What do you mean "does not work"? What are the errors? Have you read
any Oracle docs on networking?
-- Ron Reidy Oracle DBA Roland Zenner wrote:Received on Tue Apr 15 2003 - 08:06:31 CDT
> 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
![]() |
![]() |