This is a creation in
Article, where the information may have evolved or changed.
Problem:2015/12/04 17:03:36 sqldb.go:2166:sqldriverconnect: {IM005} [MICROSOFT][ODBC Driver Manager] driver Sqlallochandle on SQL_ HANDLE_DBC failure
Environment: Go language writingSQL SERVER DatabasePackages used by the "CODE.GOOGLE.COM/P/ODBC" database operation
The program just started, running all right, but after a period of time, will always appear the above error
in the system information. If no DSN exists. in addition, we can specify whether this function needs to display a dialog box to provide more information for users. for example, if the user misses the database name, he will instruct the ODBC driver to display a dialog box for the user to select the database to connect. sqlbrowseconnectlevel 1: This function allows you to enumerate data sources at runtime. it is more flexible than sqldriverconnect. Bec
function if you already have a DSN for the database you need to use. Sqldriverconnectcore This function provides a more sqlconnect choice. We can connect to a data source that is not defined within the system information. If there is no DSN. In addition, we can specify whether the function needs to display a dialog box to provide more information to the user. For example, if the user omits the name of the database, it instructs the ODBC driver to display a dialog box that allows the user to sel
characters, this greatly simplifies the use of sqlbrowseconnect functions.
2. Establish a connection with the data source
If you use odbc api functions for connection, both sqlconnect, sqldriverconnect, and sqlbrowseconnect functions can be implemented. The sqlconnect function is used to directly establish a connection with the data source given all parameters. sqldriverconnect is used to specify some
simplifies the use of SQLBrowseConnect functions.
2. Establish a connection with the data source
If you use odbc api functions for connection, both SQLConnect, SQLDriverConnect, and SQLBrowseConnect functions can be implemented. The SQLConnect function is used to directly establish a connection with the data source given all parameters. SQLDriverConnect is used to specify some connection parameters and pop
This article uses the SQL2005 + VS2008 environment to successfully connect to the database in ODBC API mode.1.SQL Installation and Environment configurationThis part of the Web-based random search has a lot of information, and it is easy to configure the success.Note the key points: sa account configuration, remote connection configuration.After the configuration succeeds, you can successfully connect to the remote database as shown in: 2. Build the console program, using the ODBC API, the lang
you use the SQL Server Native Client OLE DB access interface ADO and ADO. NET, this interface is used.
The connection string can be like this:
1 string connstr = "Server=(local);Database=AdventureWorks;User ID=sa;Password=test;MarsConn=true";
If you use the SQL Server Native Client ODBC driver
The connection string can be like this:
1 SQLSetConnectAttr(hdbc, SQL_COPT_SS_MARS_ENABLED, SQL_MARS_ENABLED_YES, SQL_IS_UINTEGER);2 SQLDriverConnect(hdbc
, hdbc); Description: A connection handle corresponds to a data source and can have multiple connection handles.
3. Connect to the data source and connect to the data source sqldriverconnect (hdbc,...) using the connection handle. Description: obtain registration information in the dialog box and connect to the data source.
4. Statement application and statement handle allocation
Sqlallocstmt (hdbc, hstmt); Description: Obtain the statement handle t
applications, you can also set the special property of the provider: ssprop_init_currentlanguage before connecting.(2) Open Database Connection (ODBC) applications can include the language keyword in the connection string specified on sqldriverconnect. ODBC applications can also specify language settings in the SQL Server ODBC Data Source definition.(3) The db-library application can use dblogin to allocate loginrec, and then use the dbsetnatlang mac
data source. A connection handle that accesses a data source contains all the connection information that includes status, transaction declarations, and error information.(3) SQLDriverConnect: Similar to SQLConnect, used to connect to a driver or data source. But it has more connection information than SQLConnect support data source;(4) SQLBrowseConnect: Supports an interactive method to retrieve or list the attributes and property values required to
example, a linked server named London payroll is created, which uses the Microsoft ole db provider for ODBC and the provider_string parameter.
For more information about ODBC connection strings, see sqldriverconnect and how to allocate handles and connect to SQL Server (ODBC.
Use masterGo-- To use named parameters:Exec sp_addmediaserver@ Server = 'London payroll ',@ Provider = 'msdasql ',@ Provstr = 'driver = {SQL Server}; server = myserver; uid = s
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.