Carlo Cancellieri | 29 Jul 04:41 2010
Picon

[DSN] create database


Hi to all,
I'm coding a script to run some tests on my application and I'd like to create a new database but seams that I
can't use isql to run a query without set a DSN. that's ok but why I've to set a database too?
-------------------------------odbc.ini
[PostgreSQL]
Description         = Test to Postgres
Driver              = /opt/unixodbc/lib/libodbcpsql.so
Trace               = Yes
TraceFile           = sql.log
######################
#Database            = SQLH  <--------PROBLEM
######################
Servername          = localhost
UserName            = postgres
Password            = postgres
Port                = 5432
Protocol            = 6.4
ReadOnly            = No
RowVersioning       = No
ShowSystemTables    = No
ShowOidColumn       = No
FakeOidIndex        = No
ConnSettings        =
-----------------------------------------

I want to create that database so how I can do this?
I've already tried to use a DSN without set the Database but this is what I get:
/opt/unixodbc/bin/isql  -c -v PostgreSQL
[28000][unixODBC]FATAL:  database "SQLH" does not exist
(Continue reading)

ikorot | 29 Jul 07:17 2010
Picon
Picon

Re: [DSN] create database

Carlo,

-----Original Message-----
>From: Carlo Cancellieri <ccancellieri <at> hotmail.com>
>Sent: Jul 28, 2010 10:41 PM
>To: unixodbc-dev <at> mailman.unixodbc.org
>Subject: [unixODBC-dev] [DSN] create database
>
>
>Hi to all,
>I'm coding a script to run some tests on my application and I'd like to create a new database but seams that I
can't use isql to run a query without set a DSN. that's ok but why I've to set a database too?
>-------------------------------odbc.ini
>[PostgreSQL]
>Description         = Test to Postgres
>Driver              = /opt/unixodbc/lib/libodbcpsql.so
>Trace               = Yes
>TraceFile           = sql.log
>######################
>#Database            = SQLH  <--------PROBLEM
>######################
>Servername          = localhost
>UserName            = postgres
>Password            = postgres
>Port                = 5432
>Protocol            = 6.4
>ReadOnly            = No
>RowVersioning       = No
>ShowSystemTables    = No
>ShowOidColumn       = No
(Continue reading)

Nick Gorham | 29 Jul 09:29 2010

Re: [DSN] create database

Carlo Cancellieri wrote:
> Hi to all,
> I'm coding a script to run some tests on my application and I'd like to create a new database but seams that I
can't use isql to run a query without set a DSN. that's ok but why I've to set a database too?
> -------------------------------odbc.ini
> [PostgreSQL]
> Description         = Test to Postgres
> Driver              = /opt/unixodbc/lib/libodbcpsql.so
> Trace               = Yes
> TraceFile           = sql.log
> ######################
> #Database            = SQLH  <--------PROBLEM
> ######################
> Servername          = localhost
> UserName            = postgres
> Password            = postgres
> Port                = 5432
> Protocol            = 6.4
> ReadOnly            = No
> RowVersioning       = No
> ShowSystemTables    = No
> ShowOidColumn       = No
> FakeOidIndex        = No
> ConnSettings        =
> -----------------------------------------
>
> I want to create that database so how I can do this?
> I've already tried to use a DSN without set the Database but this is what I get:
> /opt/unixodbc/bin/isql  -c -v PostgreSQL
> [28000][unixODBC]FATAL:  database "SQLH" does not exist
(Continue reading)

Carlo Cancellieri | 29 Jul 14:01 2010
Picon

Re: [DSN] create database


Nick,
----------------------------------------
> Date: Thu, 29 Jul 2010 08:29:22 +0100
> From: nick <at> lurcher.org
> To: unixodbc-dev <at> mailman.unixodbc.org
> Subject: Re: [unixODBC-dev] [DSN] create database
>
> Carlo Cancellieri wrote:
>> Hi to all,
>> I'm coding a script to run some tests on my application and I'd like to create a new database but seams that I
can't use isql to run a query without set a DSN. that's ok but why I've to set a database too?
>> -------------------------------odbc.ini
>> [PostgreSQL]
>> Description = Test to Postgres
>> Driver = /opt/unixodbc/lib/libodbcpsql.so
>> Trace = Yes
>> TraceFile = sql.log
>> ######################
>> #Database = SQLH <--------PROBLEM
>> ######################
>> Servername = localhost
>> UserName = postgres
>> Password = postgres
>> Port = 5432
>> Protocol = 6.4
>> ReadOnly = No
>> RowVersioning = No
>> ShowSystemTables = No
>> ShowOidColumn = No
(Continue reading)

Sebastian Wess | 31 Jul 02:23 2010

Building a single static unixODBC application + Postgres driver

I need to distribute a single application binary to connect to Postgres (or other databses) using unixODBC with no external dependencies. Is it possible to use the unixODBC driver manager when the driver itself is statically linked into the executable? It seems like unixODBC makes use of dlopen() to dynamically link in the driver at runtime, and I don't see how to get around that.

To start I would like to get a version of isql built that statically links in the Postgres driver and see if I can use that to connect. I've tried building with "./configure --enable-drivers --enable-static --enable-shared=no && make" and then manually re-linking isql with the Postgres driver with "gcc -g -O2 -pthread -o isql isql.o  ../DriverManager/.libs/libodbc.a ../extras/.libs/libodbcextraslc.a ../Drivers/Postgre7.1/.libs/libodbcpsql.a -ldl -lpthread -pthread", but odbcinst.ini seems to still require that I list a separate file in the "Driver" setting.

Is what I'm trying to do even possible?


P.S. Unfortunately I can't just bypass unixODBC and use the Postgres driver directly due to project requirements.

_______________________________________________
unixODBC-dev mailing list
unixODBC-dev <at> mailman.unixodbc.org
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev
Nick Gorham | 31 Jul 03:11 2010

Re: Building a single static unixODBC application + Postgres driver

Sebastian Wess wrote:
> I need to distribute a single application binary to connect to 
> Postgres (or other databses) using unixODBC with no external 
> dependencies. Is it possible to use the unixODBC driver manager when 
> the driver itself is statically linked into the executable? It seems 
> like unixODBC makes use of dlopen() to dynamically link in the driver 
> at runtime, and I don't see how to get around that.
>
> To start I would like to get a version of isql built that statically 
> links in the Postgres driver and see if I can use that to connect. 
> I've tried building with "./configure --enable-drivers --enable-static 
> --enable-shared=no && make" and then manually re-linking isql with the 
> Postgres driver with "gcc -g -O2 -pthread -o isql isql.o  
> ../DriverManager/.libs/libodbc.a ../extras/.libs/libodbcextraslc.a 
> ../Drivers/Postgre7.1/.libs/libodbcpsql.a -ldl -lpthread -pthread", 
> but odbcinst.ini seems to still require that I list a separate file in 
> the "Driver" setting.
>
> Is what I'm trying to do even possible?
>
>
> P.S. Unfortunately I can't just bypass unixODBC and use the Postgres 
> driver directly due to project requirements.
>
>
Well, my first suggestion would be to bipass the driver manager, what 
are the project requirements that prevent that? Without dynamic loading 
you are going to have problems with name collisions if you try and use 
the driver manager and a driver without run time linking.

You do have the code so you could make changes, though be aware you need 
to comply with the terms of the LGPL if you distribute the result and 
make the changes available.

--

-- 
Nick
_______________________________________________
unixODBC-dev mailing list
unixODBC-dev <at> mailman.unixodbc.org
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev

Sebastian Wess | 31 Jul 03:41 2010

Re: Building a single static unixODBC application + Postgres driver

Nick-

> Well, my first suggestion would be to bipass the driver manager,
> what are the project requirements that prevent that?

The requirement is that I will eventually need to be able to ship the binary with multiple drivers (Postgres and MySQL) and use the ODBC interface to talk to both of them. So am I correct in understanding that this is going to be a non-starter without some code modification of the driver manager? I.e., there's no magic configure flag that will let me have everything bundled in one big executable?


--- On Sat, 7/31/10, Nick Gorham <nick <at> lurcher.org> wrote:

From: Nick Gorham <nick <at> lurcher.org>
Subject: Re: [unixODBC-dev] Building a single static unixODBC application + Postgres driver
To: "Development issues and topics for unixODBC" <unixodbc-dev <at> mailman.unixodbc.org>
Date: Saturday, July 31, 2010, 1:11 AM

Sebastian Wess wrote:
> I need to distribute a single application binary to connect to Postgres (or other databses) using unixODBC with no external dependencies. Is it possible to use the unixODBC driver manager when the driver itself is statically linked into the executable? It seems like unixODBC makes use of dlopen() to dynamically link in the driver at runtime, and I don't see how to get around that.
>
> To start I would like to get a version of isql built that statically links in the Postgres driver and see if I can use that to connect. I've tried building with "./configure --enable-drivers --enable-static --enable-shared=no && make" and then manually re-linking isql with the Postgres driver with "gcc -g -O2 -pthread -o isql isql.o  ../DriverManager/.libs/libodbc.a ../extras/.libs/libodbcextraslc.a ../Drivers/Postgre7.1/.libs/libodbcpsql.a -ldl -lpthread -pthread", but odbcinst.ini seems to still require that I list a separate file in the "Driver" setting.
>
> Is what I'm trying to do even possible?
>
>
> P.S. Unfortunately I can't just bypass unixODBC and use the Postgres driver directly due to project requirements.
>
>
Well, my first suggestion would be to bipass the driver manager, what are the project requirements that prevent that? Without dynamic loading you are going to have problems with name collisions if you try and use the driver manager and a driver without run time linking.

You do have the code so you could make changes, though be aware you need to comply with the terms of the LGPL if you distribute the result and make the changes available.

-- Nick
_______________________________________________
unixODBC-dev mailing list
unixODBC-dev <at> mailman.unixodbc.org
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev

_______________________________________________
unixODBC-dev mailing list
unixODBC-dev <at> mailman.unixodbc.org
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev
Peter Harvey | 31 Jul 05:30 2010

Re: Building a single static unixODBC application + Postgres driver

If you need to use multiple ODBC drivers then it sounds like you will 
need to dynamically link to the drivers as needed (essentially doing 
some of what the Driver Manager does) or simply use the Driver Manager.

In the latter case you can package all of the ODBC stuff with your 
application and then install the ODBC bits as required (read; if they 
are not already installed on the system)... but I would recommend simply 
making the ODBC bits a requirement for your application (as is usually 
done). .

--
Peter

Sebastian Wess wrote:
> Nick-
>
> > Well, my first suggestion would be to bipass the driver manager,
> > what are the project requirements that prevent that?
>
> The requirement is that I will eventually need to be able to ship the 
> binary with multiple drivers (Postgres and MySQL) and use the ODBC 
> interface to talk to both of them. So am I correct in understanding 
> that this is going to be a non-starter without some code modification 
> of the driver manager? I.e., there's no magic configure flag that will 
> let me have everything bundled in one big executable?
>
>
> --- On *Sat, 7/31/10, Nick Gorham /<nick <at> lurcher.org>/* wrote:
>
>
>     From: Nick Gorham <nick <at> lurcher.org>
>     Subject: Re: [unixODBC-dev] Building a single static unixODBC
>     application + Postgres driver
>     To: "Development issues and topics for unixODBC"
>     <unixodbc-dev <at> mailman.unixodbc.org>
>     Date: Saturday, July 31, 2010, 1:11 AM
>
>     Sebastian Wess wrote:
>     > I need to distribute a single application binary to connect to
>     Postgres (or other databses) using unixODBC with no external
>     dependencies. Is it possible to use the unixODBC driver manager
>     when the driver itself is statically linked into the executable?
>     It seems like unixODBC makes use of dlopen() to dynamically link
>     in the driver at runtime, and I don't see how to get around that.
>     >
>     > To start I would like to get a version of isql built that
>     statically links in the Postgres driver and see if I can use that
>     to connect. I've tried building with "./configure --enable-drivers
>     --enable-static --enable-shared=no && make" and then manually
>     re-linking isql with the Postgres driver with "gcc -g -O2 -pthread
>     -o isql isql.o  ../DriverManager/.libs/libodbc.a
>     ../extras/.libs/libodbcextraslc.a
>     ../Drivers/Postgre7.1/.libs/libodbcpsql.a -ldl -lpthread
>     -pthread", but odbcinst.ini seems to still require that I list a
>     separate file in the "Driver" setting.
>     >
>     > Is what I'm trying to do even possible?
>     >
>     >
>     > P.S. Unfortunately I can't just bypass unixODBC and use the
>     Postgres driver directly due to project requirements.
>     >
>     >
>     Well, my first suggestion would be to bipass the driver manager,
>     what are the project requirements that prevent that? Without
>     dynamic loading you are going to have problems with name
>     collisions if you try and use the driver manager and a driver
>     without run time linking.
>
>     You do have the code so you could make changes, though be aware
>     you need to comply with the terms of the LGPL if you distribute
>     the result and make the changes available.
>
>     -- Nick
>     _______________________________________________
>     unixODBC-dev mailing list
>     unixODBC-dev <at> mailman.unixodbc.org
>     </mc/compose?to=unixODBC-dev <at> mailman.unixodbc.org>
>     http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev
>
>
>
> _______________________________________________
> unixODBC-dev mailing list
> unixODBC-dev <at> mailman.unixodbc.org
> http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev
>    

_______________________________________________
unixODBC-dev mailing list
unixODBC-dev <at> mailman.unixodbc.org
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev

Nick Gorham | 31 Jul 10:51 2010

Re: Building a single static unixODBC application + Postgres driver

Sebastian Wess wrote:
> Nick-
>
> > Well, my first suggestion would be to bipass the driver manager,
> > what are the project requirements that prevent that?
>
> The requirement is that I will eventually need to be able to ship the 
> binary with multiple drivers (Postgres and MySQL) and use the ODBC 
> interface to talk to both of them. So am I correct in understanding 
> that this is going to be a non-starter without some code modification 
> of the driver manager? I.e., there's no magic configure flag that will 
> let me have everything bundled in one big executable?
>
Its not so much as there is no magic flag, its more a matter of trying 
to link two libraries at run time with exactly the same function names 
in them. And you would have to check that the license terms of both the 
Postgres and MySQL driver was met + the LGPL of unixODBC is it was used. 
As Peter has said in effect you are trying to do exactly what unixODBC 
was designed to prevent you having to do, but it does involve dynamic 
linking.

--

-- 
Nick
_______________________________________________
unixODBC-dev mailing list
unixODBC-dev <at> mailman.unixodbc.org
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev


Gmane