원격으로는 DB에 접속이 되는데 로컬로는 접속이 안 되는 이유는 뭘까요?

익명 사용자의 이미지

질문이 좀 이상한데요.

회사에서 작업해서 서버프로그램을 만들었는데요.
회사 컴퓨터에서 서버 호스팅 업체에서 열어놓은 DB에 접속하면 문제가 없는데..
정작 만들어 놓은 프로그램을 DB가 설치되어 있는 가상서버에 복사-붙여넣기 한 다음에 실행하면 DB에 접속이 되질 않네요.

DB에 접속할 때 사용하는 코드는

{
	ADODB::_ConnectionPtr = m_lpConnection;
	HRESULT hr = ::CoInitialize(NULL);
	try
	{
		HRESULT hr;
		hr    = m_lpConnection.CreateInstance( __uuidof( ADODB::Connection ) );
		m_lpConnection->Open("Provider=SQLOLEDB.1;Persist Security Info=True;Initial 				Catalog=abcDB;Data Source=localhost", "user", "1234", NULL);
	}
	catch(_com_error &e)
	{
		ErrorHandler(e,m_ErrStr);
		ptr=NULL;
		return a;
	}
	sprintf_s(m_ErrStr,500,"Success");
	return 1;
}
void ErrorHandler(_com_error &e, char* ErrStr)
{
 
	sprintf_s(ErrStr,ErrorLength,"Error:\n");
	sprintf_s(ErrStr,ErrorLength,"%sCode = %08lx\n",ErrStr ,e.Error());
	sprintf_s(ErrStr,ErrorLength,"%sCode meaning = %s\n", ErrStr, (char*) e.ErrorMessage());
	sprintf_s(ErrStr,ErrorLength,"%sSource = %s\n", ErrStr, (char*) e.Source());
	sprintf_s(ErrStr,ErrorLength,"%sDescription = %s",ErrStr, (char*) e.Description());
	cout<<"\n"<<ErrStr<<"\n";
}

이런 식으로 만들었고요. 회사에서 접속하면 잘 연결 됩니다.

Data Source=localhost
이 부분은 가상 서버 안에서 돌리기 위해서 변경한거고요.

가상 서버에서 실행하면
Error:
code = 80004003
Code meaning = ~?
source = NULL
Description = NULL
이렇게 나옵니다.

vs2010 c++ 로 만들었고요.
다중스레드(/MT)로 빌드 했습니다.

이 코드에 문제가 있는건지 설정에 빼먹은게 있는건지 감이 안 잡히네요...

많은 조언 부탁 드립니다.

madman93의 이미지

외부에서 접속이 되고 내부에서 localhost가 안된다는건??
localhost 값이 없거나.. 다른 외적인 요인이 아닐까 합니다만? ^.^

---------------------------------------------
git init
git add .
git commit -am "project init"
---------------------------------------------

익명 사용자의 이미지

내부에서 udl 파일을 만들어서 localhost 나 여러가지 서버이름으로 연결 테스트를 할때는 잘 연결 되었거든요.

이렇게 연결에 성공한 문장을 붙여 넣기 해보고 혹시나 싶어서 타이핑으로도 해봤는데 안 되더군요.

검색도 해봤는데 80004003은 CoInitialize() 문제일거라는 글이 많아서 여러가지로 넣어봤는데

이부분을 뺐을때는 회사컴에서도 동일한 오류가 나지만 넣고 돌리면 회사에서는 잘 돌아가는데

가상서버에서는 빼던 넣던 동일한 오류가 떴습니다.

서버신입이라 실수하는 부분이나 설정같은부분에서 모르는게 많은데 빌드할 때 조건 부분에서 빼먹었을 만한건 뭔가 없을까요?

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.