Home > database >  Odbc database connection
Odbc database connection

Time:10-02

Long ll_rc
String ls_err


//Define the database transaction
The transaction ltrn_source
The transaction ltrn_target
Ltrn_source=create transaction

//Define the parameters necesary to connect to the database

Ltrn_source. DBMS="ODBC"
Ltrn_source. DBParm="connectString='DSN=pbperson" + ". UID=dba; The PWD=SQL; '
"Ltrn_target=create transaction
Ltrn_target=create transaction
Ltrn_target. DBMS="ODBC"
Ltrn_target. DBParm="ConnectString='DSN=Oldperson;" + "UID=dba; The PWD=SQL; '
"Lpipe_customer=Create u_pip_menupl_to_fox
Lpipe_customer. Ist_rowsread=st_read
Lpipe_customer. Ist_rowswritten=st_written

Lpipe_customer. DataObject="transfer_data_menupl"

Connect Using ltrn_source;
If ltrn_source. Sqlcode & lt; 0 then
MessageBox (' Source database ', 'Could Not Connect to' + '~ r ~ nSQLDBCode: + & amp;
String (ltrn_source. SQLDBCODE) + '~ r ~ nSQLErrText: + & amp;
Ltrn_Source. SQLErrText)
The Else
Connect Using ltrn_target;
If ltrn_target. Sqlcode & lt; 0 then
MessageBox (' Target database ', 'Could Not Connect to' + '~ r ~ nSQLDBCode: + & amp;
String (ltrn_Target. SQLDBCODE) + '~ r ~ nSQLErrText: + & amp;
Ltrn_Target. SQLErrText)
The else
MessageBox (" Information ", "the process about 30 minutes, please choose Cancel" to stop)
Ll_rc=lpipe_customer. Start (ltrn_source ltrn_target, dw_1)

If ll_rc & lt; 0 then
CHOOSE a CASE ll_rc
CASE 1
Ls_err='Pipe open failed'
CASE 2
-Ls_err='Too many columns'
CASE - 3
Ls_err='Table already exist'
CASE - 4
Ls_err='Table does not exist'
CASE - 5
Ls_err='missing connection'
CASE - 6
Ls_err='Wrong the arguments'
CASE - 7
='Column ls_err mismatch'
CASE - 8
Ls_err='Fatal SQL error source in'

CASE - 9
Ls_err='Fatal SQL error in destination'
CASE - 10
Ls_err='Maximum number of errors exceeded'
CASE - 11
Ls_err='Bad table syntax'
CASE - 12
Ls_err='Bad table syntax'
CASE - 13
Ls_err='Key required but not supplied'
CASE - 14

CASE - 15
Ls_err='Pipe already in proress'
CASE - 16
Ls_err='Error in the source database'
CASE - 17
Ls_err='Error in destination databse'
CASE - 18
Ls_err='Destination database is read - only'
The END CHOOSE

MessageBox (' Pipline ', 'Rows Read:' + String (lpipe_customer. RowsRead) + & amp;
'~ r ~ nRows Written:' + & amp;
String (lpipe_customer. RowsWritten))
End the if

End the if

End the if
Destroy lpipe_customer
Destroy ltrn_source
Destroy ltrn_target
MessageBox (" information ", "data transmission to complete!" )


Tip the following error: unable to connect; Sqldbccode: 999; Sqlerrtext: sqlstate=IM002; Did not find the data source and is not specified the default driver,
Can you tell me how to solve? thank you

CodePudding user response:

Connection to the database driver
  • Related