comp.lang.ada
 help / color / mirror / Atom feed
* GNADE/ODBC connection problem
@ 2008-10-03 13:14 soychangoman
  2008-10-03 13:57 ` Ludovic Brenta
  2008-10-04 20:54 ` Maciej Sobczak
  0 siblings, 2 replies; 5+ messages in thread
From: soychangoman @ 2008-10-03 13:14 UTC (permalink / raw)


I'm trying to use GNADE to connect to a MySQL database but i keep
getting the same error:

raised GNU.DB.SQLCLI.DRIVER_ERROR :
[Proc=SQLConnect][Server=][State=IM002][unixODBC][Driver Manager]Data
source name not found, and no default driver specified

I'm using Debian Sid with and amd64 architecture.

This is the code I'm trying to run:

--------------------------------------------
with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;

with GNU.DB.SQLCLI;
use GNU.DB.SQLCLI;

with GNU.DB.SQLCLI.Environment_Attribute;
use GNU.DB.SQLCLI.Environment_Attribute;



procedure sql_test_2 is

EnvironmentHandle : SQLHENV;
ConnectionHandle : SQLHDBC;

DSN : Unbounded_String := To_Unbounded_String("gnade");
UserName : Unbounded_String := To_Unbounded_String("gnade");
Password : Unbounded_String := To_Unbounded_String("gnade");


begin

SQLAllocHandle (
SQL_HANDLE_ENV,
SQL_NULL_HANDLE,
EnvironmentHandle
);

SQLSetEnvAttr (
EnvironmentHandle,
Environment_Attribute_ODBC_Version'
(Attribute => SQL_ATTR_ODBC_VERSION,
Value => SQL_OV_ODBC3)
);

SQLAllocHandle (SQL_HANDLE_DBC, EnvironmentHandle, ConnectionHandle);



SQLConnect(ConnectionHandle => ConnectionHandle,
ServerName => To_String(DSN),
UserName => To_String(UserName),
Authentication => To_String(Password));


end sql_test_2;
---------------------------------------------

The "gnade" database does exists and I have installed almost all the
drivers I could find.

Thanks

Matías Niklison



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: GNADE/ODBC connection problem
  2008-10-03 13:14 GNADE/ODBC connection problem soychangoman
@ 2008-10-03 13:57 ` Ludovic Brenta
  2008-10-03 15:39   ` soychangoman
  2008-10-04 20:54 ` Maciej Sobczak
  1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Brenta @ 2008-10-03 13:57 UTC (permalink / raw)


On Oct 3, 3:14 pm, soychango...@gmail.com wrote:
> I'm trying to use GNADE to connect to a MySQL database but i keep
> getting the same error:
>
> raised GNU.DB.SQLCLI.DRIVER_ERROR :
> [Proc=SQLConnect][Server=][State=IM002][unixODBC][Driver Manager]Data
> source name not found, and no default driver specified

Have you configured your odbc.ini file? GNADE looks there for the data
source name you specified in your Ada program and for the driver it
should load to access the database.  The configuration of odbc.ini is
outside the scope of GNADE as this is really part of UnixODBC (which,
of course, I assume you have installed).

--
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: GNADE/ODBC connection problem
  2008-10-03 13:57 ` Ludovic Brenta
@ 2008-10-03 15:39   ` soychangoman
  0 siblings, 0 replies; 5+ messages in thread
From: soychangoman @ 2008-10-03 15:39 UTC (permalink / raw)


On Oct 3, 10:57 am, Ludovic Brenta <ludo...@ludovic-brenta.org> wrote:

> Have you configured your odbc.ini file? GNADE looks there for the data
> source name you specified in your Ada program and for the driver it
> should load to access the database.  The configuration of odbc.ini is
> outside the scope of GNADE as this is really part of UnixODBC (which,
> of course, I assume you have installed).


That worked just fine. Thank you VERY much.

Matías Niklison.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: GNADE/ODBC connection problem
  2008-10-03 13:14 GNADE/ODBC connection problem soychangoman
  2008-10-03 13:57 ` Ludovic Brenta
@ 2008-10-04 20:54 ` Maciej Sobczak
  2008-10-05  7:07   ` Dmitry A. Kazakov
  1 sibling, 1 reply; 5+ messages in thread
From: Maciej Sobczak @ 2008-10-04 20:54 UTC (permalink / raw)


On 3 Paź, 15:14, soychango...@gmail.com wrote:

> I'm trying to use GNADE to connect to a MySQL database

And it *really* takes so many lines of code? Horror. :-)

Depending on your needs, the following library might be enough:

http://www.inspirel.com/soci-ada/

These are *complete* program examples:

http://www.inspirel.com/soci-ada/doc/idioms.html

The SOCI library uses native interface for MySQL, so there is nothing
to configure.

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: GNADE/ODBC connection problem
  2008-10-04 20:54 ` Maciej Sobczak
@ 2008-10-05  7:07   ` Dmitry A. Kazakov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry A. Kazakov @ 2008-10-05  7:07 UTC (permalink / raw)


On Sat, 4 Oct 2008 13:54:28 -0700 (PDT), Maciej Sobczak wrote:

> On 3 Paďż˝, 15:14, soychango...@gmail.com wrote:
> 
>> I'm trying to use GNADE to connect to a MySQL database
> 
> And it *really* takes so many lines of code? Horror. :-)

Yep, this is the nature of ODBC. That is not GNADE's fault, which is thin
binding. I added a bit more fat to it when used in the Simple Components,
by wrapping connection, command into tagged objects. But the main stumbling
block remains, it is SQL.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-10-05  7:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-03 13:14 GNADE/ODBC connection problem soychangoman
2008-10-03 13:57 ` Ludovic Brenta
2008-10-03 15:39   ` soychangoman
2008-10-04 20:54 ` Maciej Sobczak
2008-10-05  7:07   ` Dmitry A. Kazakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox