![]() ![]() Status = SQLExecDirect(hStmt,(SQLWCHAR *) " Select * from lookup_hand_groups", SQL_NTS) Here we get the employee records from Northwind database. ![]() Status = SQLSetStmtAttr(hStmt, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_STATIC, 0) Status = SQLAllocHandle(SQL_HANDLE_STMT, hDbc, &hStmt) (SQLWCHAR *) " dbpass", SQL_NTS) // connect to DSN // 6. Status = SQLConnect(hDbc,(SQLWCHAR *) " postgres", SQL_NTS, ![]() Status = SQLSetConnectAttr(hDbc, SQL_LOGIN_TIMEOUT,( void *) 5, 0) Set Connection Login Timeout to 5 seconds. Status = SQLAllocHandle(SQL_HANDLE_DBC, hEnv, &hDbc) Status = SQLSetEnvAttr(hEnv, SQL_ATTR_ODBC_VERSION, ( void *) SQL_OV_ODBC3, 0) Status = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &hEnv) SQLRETURN status // SQL return variable to test success or failure // 1. SQLHANDLE hEnv // ODBC Environment handle It's a console application (later I will write the reports to a csv file), that's what I have so far: Server name is postgres, database name is PT3_2010, username is postgres, password is dbpass. At first, I tried to access the lookup_hand_groups table. I tried to amend it to work with postgreSQL. I found an example on the net with an access database here: So far I updated postgres to 8.3.9 with psqlodbc 8.4 (that's what was automatically installed with it). Then I found out about ODBC, and I try this for now. It had configuration problems I couldn't solve. I tried at first with libpqxx, but I couldn't even compile it's test programs. I am a slightly advanced C++ programmer, but I'm new to databases. I try to access a local postgres database (actually it is a PokerTracker3 database) from Visual C++ 2008, because I'd like to do a lot of regular analysis, which takes hours of work with PT3, but if I write a standalone program, it can make it for me by a push of a button. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |