Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > IBM DB2 > db2 Lode Api
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 8787 of 9056
Post > Topic >>

db2 Lode Api

by "dbinter" <u42877@[EMAIL PROTECTED] > Apr 13, 2008 at 09:00 AM

i am trying to load a csv file into dbtable using DB2Load Api ,

i am getting unhandled exception, Accessvoilation Error at

db2load(version,paramstructure, sqlca ) 


my code as follows.


i am suspecting there is some thing paramstruct , can any one guide me.

Thanks in advance.


Regards.

DBinter.

int DB2BulkLoad::LoadIntoDbTable (char *dataFileName)
{
  int rc = 0;
  struct sqlca sqlca = {0};

  struct db2LoadStruct paramStruct = {0};
  struct db2LoadIn inputInfoStruct = {0};
  struct db2LoadOut outputInfoStruct = {0};

  struct sqlu_media_list mediaList = {0};
  struct sqldcol dataDescriptor = {0};
  char actionString[256];
  struct sqlchar *pAction = {0};
  char localMsgFileName[128];

   strcpy(m_tableName,"");
  strcat(m_tableName,"TEST_BULKLOAD");
 
   sqluvqdp(m_tableName, SQLU_QUIESCEMODE_RESET_OWNED, NULL, &sqlca);
 
 DB2_API_CHECK("tablespaces for table -- quiesce");

  mediaList.media_type = SQLU_CLIENT_LOCATION;
  mediaList.sessions = 1;
  mediaList.target.location = new sqlu_location_entry[mediaList.sessions];
  strcpy(mediaList.target.location->location_entry, dataFileName);

  dataDescriptor.dcolmeth = SQL_METH_D;

  
  strcpy(actionString, "INSERT INTO ");
  
  strcat(actionString, m_tableName);
  
  
  pAction = (struct sqlchar *)new char[sizeof(short) +
                                       sizeof(actionString) + 1];
  pAction->length = strlen(actionString);
  strcpy(pAction->data, actionString);

  strcpy(localMsgFileName, "tbload.MSG");

  inputInfoStruct.piUseTablespace       = NULL;
  inputInfoStruct.iSavecount    =  0;       /* consistency points as
                                               infrequently as possible */
  inputInfoStruct.iRestartcount =  0;       /* start at row 1 */
  inputInfoStruct.iRowcount 	=  0;       /* load all rows */
  inputInfoStruct.iWarningcount =  0;        /* don't stop for warnings */
  inputInfoStruct.iDataBufferSize =  0;      /* default data buffer size
*/
  inputInfoStruct.iSortBufferSize  =  0;     /* def. warning buffer size
*/
  inputInfoStruct.iHoldQuiesce     =  0;     /* don't hold the quiesce */
  inputInfoStruct.iRestartphase    =  ' ';   /* ignored anyway */
  inputInfoStruct.iStatsOpt = SQLU_STATS_NONE; /* don't bother with them
*/
  inputInfoStruct.iIndexingMode = SQLU_INX_AUTOSELECT;

inputInfoStruct.iCpuParallelism  =  0;
  inputInfoStruct.iNonrecoverable  =  SQLU_NON_RECOVERABLE_LOAD;
  inputInfoStruct.iAccessLevel     =  SQLU_ALLOW_NO_ACCESS;
  inputInfoStruct.iLockWithForce   =  SQLU_NO_FORCE;

  inputInfoStruct.iSetIntegrityPending = 
SQLU_SI_PENDING_CASCADE_DEFERRED;

  /* Setup the parameter structure */
  paramStruct.piSourceList = &mediaList;
  paramStruct.piLobPathList = NULL;
  paramStruct.piDataDescriptor = &dataDescriptor;
  paramStruct.piActionString = pAction;
  paramStruct.piFileType = SQL_DEL;
  paramStruct.piFileTypeMod = NULL;
  paramStruct.piLocalMsgFileName = localMsgFileName;
  paramStruct.piTempFilesPath =   NULL;
  paramStruct.piVendorSortWorkPaths = NULL;
  paramStruct.piCopyTargetList = NULL;
  paramStruct.piNullIndicators = NULL;
  paramStruct.piLoadInfoIn = &inputInfoStruct;
  paramStruct.poLoadInfoOut    = &outputInfoStruct;
  paramStruct.piPartLoadInfoIn  = NULL;
  paramStruct.poPartLoadInfoOut = NULL;
  paramStruct.iCallerAction = SQLU_INITIAL;
 
  db2Load (db2Version900,&paramStruct, & sqlca );                
  
   DB2_API_CHECK("table -- load");

  delete [] pAction;

 return 0;
}
 




 1 Posts in Topic:
db2 Lode Api
"dbinter" <u  2008-04-13 09:00:53 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 6 22:00:11 CDT 2008.