SQLGetInfo returning HP Database for SQL_DBMS_NAME

Bug #1436719 reported by Aruna Sadashiva
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Trafodion
Fix Committed
High
Daniel Lu

Bug Description

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);
}

Changed in trafodion:
assignee: nobody → Daniel Lu (ping-lu)
Daniel Lu (ping-lu)
Changed in trafodion:
status: New → In Progress
Daniel Lu (ping-lu)
Changed in trafodion:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.