Home » U++ Library support » U++ SQL » How to connect to ODBC??
How to connect to ODBC?? [message #47798] |
Wed, 29 March 2017 09:42 |
NilaT
Messages: 70 Registered: November 2011 Location: Austria
|
Member |
|
|
Hello everyone, I have a new question for you
I have a mdb Database and I want to connect to it with U++ using ODBC.
So, I added the data source to ODBC32 Bit:
For User-DSN and System-DSN.
Name is anything, Platform is 32 Bit, Driver is Driver do Microsoft Access (*.mdb) and also tried Microsoft Access Driver (*.mdb)
Then, in my program, I use the following code:
(be aware that I use 2010 sources):
ODBCSession session;
if(!session.IsOpen())
{
String cs = Format("DRIVER=%s;SERVER=(local);Trusted_Connection=yes;", "something"); // DRIVER is the same name as in ODBC data source, also tried {SQL Server}
if(!session.Connect(cs))
{
Cout() << session.GetErrorStatement() << "\n";
}
}
With DRIVER = "something" I get the error: [Microsoft][ODBC Driver Manager]The datasource was not found, no standard driver... (translated to english, original error message is german so may it's not 100% the right message)
With DRIVER = {SQL Server} I get: [Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not exist or connection refused
and [Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionOpen (Connect())
I also tried disabling the firewall, with no success.
Am I missing something?
Please help me.
Thanks
|
|
|
|
Goto Forum:
Current Time: Wed Apr 24 06:25:05 CEST 2024
Total time taken to generate the page: 0.05830 seconds
|