Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » dbaccess via odbc
dbaccess via odbc [message #16805] Sat, 12 July 2008 12:05 Go to next message
maxmeier is currently offline  maxmeier
Messages: 9
Registered: July 2008
Location: Nürnberg
Promising Member
Hi all,

i'm looking for a direct odbc approach to database (must connect to MS Access and DB2).
All i found in the forum was msg. #7788 where a package for that purpose is announced (msg was posted in Jan/2007). What's the current state about that?
And if odbc is possible: is there an example?

Thanks + greets
maxmeier

[Updated on: Sat, 12 July 2008 12:48]

Report message to a moderator

Re: dbaccess via odbc [message #16806 is a reply to message #16805] Sat, 12 July 2008 13:00 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

There is no plugin for upp database package. In my database explorer I use odbc directly (I have my own sql/connection classes) - it's not so hard. Unfortunately my code is too mixed with other database explorer parts to be posted here.
Remember that you can always use OleDb. Upp supports it very well.
Re: dbaccess via odbc [message #16807 is a reply to message #16806] Sat, 12 July 2008 14:33 Go to previous messageGo to next message
maxmeier is currently offline  maxmeier
Messages: 9
Registered: July 2008
Location: Nürnberg
Promising Member
Hi,

thanks for your answer. I added OleDB and Sql packages and tried the following...

#include <Core/Core.h>
#include <OleDB.h>

using namespace Upp;

CONSOLE_APP_MAIN
{
OleDBSession sess;
}

...and got a compile error from win sdk and moreover compiler says that "OleDBSession" is not known:

c:\program files\microsoft sdks\windows\v6.0a\include\ocidl.h(2809) : error C2061: Syntaxfehler: Bezeichner 'CY'
c:\program files\microsoft sdks\windows\v6.0a\include\ocidl.h(2812) : error C2061: Syntaxfehler: Bezeichner 'CY'
D:\cpp_projects\MyApps\CoreConsole1\CoreConsole1.cpp(12) : error C2065: 'OleDBSession': nichtdeklarierter Bezeichner
Mad

Can you help?

BTW: where can I have a look into your database explorer? Couldn't find something like that in the upp-sources.

Bye
maxmeier

[Updated on: Sat, 12 July 2008 14:45]

Report message to a moderator

Re: db access via odbc [message #16808 is a reply to message #16807] Sat, 12 July 2008 15:30 Go to previous messageGo to next message
maxmeier is currently offline  maxmeier
Messages: 9
Registered: July 2008
Location: Nürnberg
Promising Member
ok. forget it.
Header is not OleDB.h but OleDB/OleDB.h
icon4.gif  Re: db access via odbc [message #18090 is a reply to message #16808] Wed, 10 September 2008 11:11 Go to previous messageGo to next message
lgon is currently offline  lgon
Messages: 4
Registered: September 2008
Location: Tenteniguada
Junior Member
Hi 2 all:

It doesn't work for me! I have added the package correctly and I have the correct include. It gives me the same error:
 'OleDBSession' does not name a type


when I try to include a oledbsession object into a class or I declare it into main.

Help please. Sad
Re: db access via odbc [message #18102 is a reply to message #18090] Wed, 10 September 2008 15:15 Go to previous messageGo to next message
pepe11 is currently offline  pepe11
Messages: 16
Registered: June 2006
Location: Slovakia
Promising Member

Hi,

I don't have problems with OleDBSession object. I put into class or it is declare in main().

I am using it for the connection to MS SQL :

if(!oledb->OpenProp(Format("DRIVER={SQL Server};SERVER=%s;
or
if(!oledb->OpenProp(Format("Provider=SQLOLEDB;Data Source=%s

And it’s work.

Put the code there.


Pepe
Re: db access via odbc [message #18104 is a reply to message #18102] Wed, 10 September 2008 16:23 Go to previous messageGo to next message
lgon is currently offline  lgon
Messages: 4
Registered: September 2008
Location: Tenteniguada
Junior Member
here is my manveic.h
#ifndef _manveic_manveic_h
#define _manveic_manveic_h

#include <CtrlLib/CtrlLib.h>
#include <OleDB/OleDB.h>
using namespace Upp;

#define LAYOUTFILE <manveic/manveic.lay>
#include <CtrlCore/lay.h>



class cprincipal : public WithcprincipalLayout<TopWindow> {
	typedef cprincipal CLASSNAME;
public:
	MenuBar menu;
	OleDBSession bd;
	cprincipal();
	void Exit();
	void SubMenu(Bar& bar);
	void SubMenuListados(Bar& bar);
	void MainMenu(Bar& bar);
	void NuevoVehiculo();
	void ListadoVehiculos();
};
#endif



and here is the main.cpp
#include "manveic.h"

cprincipal::cprincipal()
{
	CtrlLayout(*this, "");
	Title("Mantenimiento de Vehículos").Sizeable();

        AddFrame(menu);
        menu.Set(THISBACK(MainMenu));
        bd.Open("admin"¸ ""¸ "C:\\Users\\Luis\\Carpeta de Trabajo\\mantenimiento vehiculos\\gastos.mdb"¸ "Microsoft.Jet.OLEDB.4.0");
}

GUI_APP_MAIN
{
	cprincipal().Run();

}




The errors:

In file included from C:\Users\Luis\Carpeta de Trabajo\manveic\main.cpp:1:
C:\Users\Luis\Carpeta de Trabajo\manveic\/manveic.h:17: error: 'OleDBSession' does not name a type
C:\Users\Luis\Carpeta de Trabajo\manveic\main.cpp: In constructor 'cprincipal::cprincipal()':
C:\Users\Luis\Carpeta de Trabajo\manveic\main.cpp:10: error: 'bd' was not declared in this scope

[Updated on: Wed, 10 September 2008 16:24]

Report message to a moderator

Re: db access via odbc [message #18105 is a reply to message #18104] Wed, 10 September 2008 17:46 Go to previous messageGo to next message
pepe11 is currently offline  pepe11
Messages: 16
Registered: June 2006
Location: Slovakia
Promising Member

You are using probably MINGW. Try use MS Compiler..

look to the OleDB/OleDB.h

Quote:

#ifndef __OLEDB_H__
#define __OLEDB_H__

#include <Sql/Sql.h>

#if defined(PLATFORM_WIN32) && defined(COMPILER_MSC)


Pepe
Re: db access via odbc [message #18106 is a reply to message #18105] Wed, 10 September 2008 18:06 Go to previous messageGo to next message
lgon is currently offline  lgon
Messages: 4
Registered: September 2008
Location: Tenteniguada
Junior Member
Yes I'm using MingGW sorry by not specify Rolling Eyes . I will download the microsoft sdk and try it. Thanks Pepe.

[Updated on: Wed, 10 September 2008 18:06]

Report message to a moderator

icon14.gif  Re: db access via odbc [message #18116 is a reply to message #18106] Wed, 10 September 2008 21:03 Go to previous messageGo to next message
lgon is currently offline  lgon
Messages: 4
Registered: September 2008
Location: Tenteniguada
Junior Member
It works!! Thanks Very Happy

P.D: I have to use the OpenProp method instead of Open
Re: db access via odbc [message #18293 is a reply to message #18104] Sun, 21 September 2008 09:03 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
lgon wrote on Wed, 10 September 2008 10:23

bd.Open("admin"¸ ""¸ "C:\\Users\\Luis\\Carpeta de Trabajo\\mantenimiento vehiculos\\gastos.mdb"¸ "Microsoft.Jet.OLEDB.4.0");



Please, read FAQ about "strange comma".

Mirek
Previous Topic: MySql basic example
Next Topic: linking error trying to compile SQL_MySql demo on linux fedora 9
Goto Forum:
  


Current Time: Sun Apr 28 15:33:10 CEST 2024

Total time taken to generate the page: 0.07147 seconds