连接不下PostgreSQL数据库

连接不上PostgreSQL数据库

我是新手,刚刚接触PostgreSQL数据库,今天研究怎么去连接它弄了半天也没连上,请各位高手指点一下,我实在windows xp下,用VS2005的编译环境,我写的代码如下:

#include “stdafx.h”

int _tmain(int argc, _TCHAR* argv[])

{

_ConnectionPtr m_pConnection=NULL;

HRESULT hr=m_pConnection.CreateInstance(__uuidof(Connection));

hr=m_pConnection->Open(“Driver={PostgreSQL};Server=192.168.1.104;Port=5432;Database=Student Management”,”postgres”,”1234″,adModeUnknown);

if(m_pConnection->State)

cout<<“数据库已连接!”;

return 0;

}

编译能通过,在运行到红色语句时,弹出对话框 “Unhandled exception at 0x7c812a6b in 2.exe: Microsoft C++ exception: _com_error at memory location 0x0012fd0c..”

继续后,又弹出对话框 “Unhandled exception at 0x004126fd in 2.exe: 0xC0000005: Access violation reading location 0x00000000.”

并且无法继续了(我逐句运行调试的),不知道是哪里出了问题,期待高手的指点,先谢过了!!!



你系统c++能运行吗

有环境吗

问题应该不是sql



你是不是也是新接触ADO啊?

连接不下PostgreSQL数据库

相关文章:

你感兴趣的文章:

标签云: