Arama butonu
Bu konudaki kullanıcılar: 1 misafir
2
Cevap
609
Tıklama
0
Öne Çıkarma
mysql c++ bağlanntısı
D
10 yıl
Teğmen
Konu Sahibi

arkadaşlar bir iki hafta önce araştırdım biraz denedim beceremedim şimdi yine denedim yine olmuoyr kullandığım konnektör 1.3.3 x64

kullanılan ide visual studio 2010 libleri ekliyorum dll yi proje içine atıyorum include leri yapıyorum proje ayarlarında bir türlü beceremedim bi yardım edin.






// MySql64.cpp : Defines the entry point for the console application. 
//

#include "stdafx.h"
/* Copyright 2008, 2010, Oracle and/or its affiliates. All rights reserved.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.

There are special exceptions to the terms and conditions of the GPL
as it is applied to this software. View the full text of the
exception in file EXCEPTIONS-CONNECTOR-C++ in the directory of this
software distribution.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

/* Standard C++ includes */
#include <stdlib.h>
#include <iostream>

/*
Include directly the different
headers from cppconn/ and mysql_driver.h + mysql_util.h
(and mysql_connection.h). This will reduce your build time!
*/
#include "mysql_connection.h"

#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>

using namespace std;

int main(void)
{

try {
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;

/* Create a connection */
driver = get_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "root", "root");
/* Connect to the MySQL test database */
con->setSchema("test");

stmt = con->createStatement();
res = stmt->executeQuery("SELECT 'Hello World!' AS _message");
while (res->next()) {
cout << "\t... MySQL replies: ";
/* Access column data by alias or column name */
cout << res->getString("_message") << endl;
cout << "\t... MySQL says it again: ";
/* Access column fata by numeric offset, 1 is the first column */
cout << res->getString(1) << endl;
}
delete res;
delete stmt;
delete con;

} catch (sql::SQLException &e) {

cout << " (MySQL error code: " << e.getErrorCode();
cout << ", SQLState: " << e.getSQLState() << " )" << endl;
}

cout << endl;

return EXIT_SUCCESS;
}



hata 1>MySql64.obj : error LNK2019: unresolved external symbol _get_driver_instance referenced in function _main



R
10 yıl
Yarbay

Visual studioda bilmiyorum da ben Linux NetBeans'e kurarken 2 dosya çıkmıştı static ve dynamic library olarak ikisinden sadece birini linkerdan ekliyorduk. Öyle bir şey olabilir.


Bu mesaja 1 cevap geldi.
D
10 yıl
Teğmen
Konu Sahibi

quote:

Orijinalden alıntı: Eleasar

Visual studioda bilmiyorum da ben Linux NetBeans'e kurarken 2 dosya çıkmıştı static ve dynamic library olarak ikisinden sadece birini linkerdan ekliyorduk. Öyle bir şey olabilir.

yok yine olmadı



DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.