You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "Alice Chen (JIRA)" <ji...@apache.org> on 2015/07/22 20:19:42 UTC

[jira] [Created] (TRAFODION-1090) LP Bug: 1436719 - SQLGetInfo returning HP Database for SQL_DBMS_NAME

Alice Chen created TRAFODION-1090:
-------------------------------------

             Summary: LP Bug: 1436719 - SQLGetInfo returning HP Database for SQL_DBMS_NAME
                 Key: TRAFODION-1090
                 URL: https://issues.apache.org/jira/browse/TRAFODION-1090
             Project: Apache Trafodion
          Issue Type: Bug
          Components: client-odbc-linux
            Reporter: Aruna Sadashiva
            Assignee: Daniel Lu
            Priority: Critical
             Fix For: 1.1 (pre-incubation)


SQLGetInfo returns "HP Database" for SQL_DBMS_NAME on Linux. It returns Trafodion on Windows. 

[trafodion@n007 gentests]$ getdbname
Connected
SQL_DBMS_NAME : HP Database
SQL_DATABASE_NAME : TRAFODION
Done

Test code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <sql.h>
#include <sqlext.h>

int main( )
{
	SQLHENV         hEnv    = SQL_NULL_HENV;
	SQLHDBC         hDbc    = SQL_NULL_HDBC;
	SQLHSTMT        hStmt   = SQL_NULL_HSTMT;
	SQLRETURN       rc      = SQL_SUCCESS;

	rc = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &hEnv);
	if (!SQL_SUCCEEDED(rc))
	{
		puts ("Failed to allocate env");
		return (1);
	}
	rc = SQLSetEnvAttr(hEnv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER*)SQL_OV_ODBC3, 0); 
	if (!SQL_SUCCEEDED(rc))
	{
		puts ("Failed to set odbc version");
		return (1);
	}
	rc = SQLAllocHandle(SQL_HANDLE_DBC, hEnv, &hDbc);
	if(!SQL_SUCCEEDED(rc))    
	{
		puts ("Failed to allocate dbc");
		return (1);
	}
	rc = SQLConnect(hDbc, (SQLCHAR *) "traf", SQL_NTS, (SQLCHAR *) "a", SQL_NTS, (SQLCHAR *) "a", SQL_NTS);
	if(!SQL_SUCCEEDED(rc))
	{
		puts ("Failed to connect");
		return (1);
	}
	puts("Connected");
	SQLCHAR Obuff[128];		
	int bufferSize = 128;
	rc = SQLGetInfo(hDbc, SQL_DBMS_NAME, Obuff, (SQLSMALLINT)bufferSize, (SQLSMALLINT *)&bufferSize);
	if(!SQL_SUCCEEDED(rc))
	{
		puts ("SQLGetInfo failed");
		return (1);
	}
	printf ("SQL_DBMS_NAME : %s\n", Obuff);
	rc = SQLGetInfo(hDbc, SQL_DATABASE_NAME, Obuff, (SQLSMALLINT)bufferSize, (SQLSMALLINT *)&bufferSize);
	if(!SQL_SUCCEEDED(rc))
	{
		puts ("SQLGetInfo failed");
		return (1);
	}
	printf ("SQL_DATABASE_NAME : %s\n", Obuff);
	rc = SQLDisconnect(hDbc);
	if (rc != SQL_SUCCESS)
	if(!SQL_SUCCEEDED(rc))
	{
		puts ("Failed to disconnect");
		return (1);
	}
	rc = SQLFreeHandle(SQL_HANDLE_DBC, hDbc);
	if (rc != SQL_SUCCESS)
	if(!SQL_SUCCEEDED(rc))
	{
		puts ("Failed to free dbc");
		return (1);
	}
	rc = SQLFreeHandle(SQL_HANDLE_ENV, hEnv);
	if (rc == SQL_SUCCESS)
	if(!SQL_SUCCEEDED(rc))
	{
		puts ("Failed to free env");
		return (1);
	}
	puts ("Done");
	return (0);
}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)