Creates a connection to a SQL Anywhere database server using the specified connection object and connection string.
sacapi_bool sqlany_connect( a_sqlany_connection * conn, const char * str )
conn The connection object created by sqlany_new_connection.
str A SQL Anywhere connection string.
1 if the connection is established successfully or 0 when the connection fails. Use sqlany_error to retrieve the error code and message.
a_sqlany_connection * conn; conn = sqlany_new_connection(); if( !sqlany_connect( conn, "uid=dba;pwd=sql" ) ) { char reason[SACAPI_ERROR_SIZE]; sacapi_i32 code; code = sqlany_error( conn, reason, sizeof(reason) ); printf( "Connection failed. Code: %d Reason: %s\n", code, reason ); } else { printf( "Connected successfully!\n" ); sqlany_disconnect( conn ); } sqlany_free_connection( conn ); |
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |