请教各位, OCCI 连接oracle编译通过了,但是运行到createConnection,老有异常,就是下面这句:
Connection *conn = env->createConnection (username, password, url);异常如下:
Unhandled exception at 0x612f8a52 in OracleTest.exe: 0xC0000005: Access violation writing location 0x00000000.堆栈信息:
ORANLS10.DLL!612f8a52()
[Frames below may be incorrect and/or missing, no symbols loaded for ORANLS10.DLL]
ntdll.dll!7c9106eb()
msvcrt.dll!77c2c3c9()
oraclient10.dll!606ebc37()
oraclient10.dll!606256e8()
oci.dll!00390387()
oraocci10.dll!oracle:cci::ConnectionImpl::setUserName() + 0x38 bytes
oraocci10.dll!oracle:cci::ConnectionImpl::ConnectionImpl() + 0x72 bytes
oraocci10.dll!oracle:cci::EnvironmentImpl::createConnection() + 0x8b bytes
> OracleTest.exe!occidml:ccidml(std::basic_string<char,std::char_traits<char>,std::allocator<char> > user="scott", std::basic_string<char,std::char_traits<char>,std::allocator<char> > passwd="scott", std::basic_string<char,std::char_traits<char>,std::allocator<char> > db="") Line 40 + 0x21 bytes C++
OracleTest.exe!main() Line 255 + 0xcb bytes C++
OracleTest.exe!__tmainCRTStartup() Line 586 + 0x19 bytes C
OracleTest.exe!mainCRTStartup() Line 403 C
kernel32.dll!7c816fd7()
代码如下:
#include <iostream>
#include <fstream>
#include <occi.h>
#include <unistd.h>
#include <string>using namespace oracle:cci;
using namespace std;int main (void)
{
try
{
Environment *env = Environment::createEnvironment (
Environment:EFAULT);
Connection *conn = env->createConnection (username, password, url);
cout << "Start runImageSample\n";
.....
.....
}
catch (exception &e)
{}
}
Connection *conn = env->createConnection (username, password, url);异常如下:
Unhandled exception at 0x612f8a52 in OracleTest.exe: 0xC0000005: Access violation writing location 0x00000000.堆栈信息:
ORANLS10.DLL!612f8a52()
[Frames below may be incorrect and/or missing, no symbols loaded for ORANLS10.DLL]
ntdll.dll!7c9106eb()
msvcrt.dll!77c2c3c9()
oraclient10.dll!606ebc37()
oraclient10.dll!606256e8()
oci.dll!00390387()
oraocci10.dll!oracle:cci::ConnectionImpl::setUserName() + 0x38 bytes
oraocci10.dll!oracle:cci::ConnectionImpl::ConnectionImpl() + 0x72 bytes
oraocci10.dll!oracle:cci::EnvironmentImpl::createConnection() + 0x8b bytes
> OracleTest.exe!occidml:ccidml(std::basic_string<char,std::char_traits<char>,std::allocator<char> > user="scott", std::basic_string<char,std::char_traits<char>,std::allocator<char> > passwd="scott", std::basic_string<char,std::char_traits<char>,std::allocator<char> > db="") Line 40 + 0x21 bytes C++
OracleTest.exe!main() Line 255 + 0xcb bytes C++
OracleTest.exe!__tmainCRTStartup() Line 586 + 0x19 bytes C
OracleTest.exe!mainCRTStartup() Line 403 C
kernel32.dll!7c816fd7()
代码如下:
#include <iostream>
#include <fstream>
#include <occi.h>
#include <unistd.h>
#include <string>using namespace oracle:cci;
using namespace std;int main (void)
{
try
{
Environment *env = Environment::createEnvironment (
Environment:EFAULT);
Connection *conn = env->createConnection (username, password, url);
cout << "Start runImageSample\n";
.....
.....
}
catch (exception &e)
{}
}
如:我用msvc71 使用oraclehome\OCI\lib\MSVC\vc71下的lib和dll(还分debug版本和release版本,debug版本后为d结尾