Web OK, command-line.. not yet!

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Web OK, command-line.. not yet!

Jean-Roch Grenetier
Hello,
 
It's probably a simple one, I think the visibility of .odbc.ini
 
- everything works from Web requests on our Apache-Modperl server. It knows where to find /web/.odbc.ini
 
- but from the command-line calling the same modperl program than the Web request do, I've got an 'Unknown host machine name'. I've copied .odbc.ini pretty much everywhere, so that it be visible to this command-line user. Hint: all other classical Perl DBI connections work from both Web requests and command-line.
 
DBI connect('db_one','optimus',...) failed: [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (SQL-08001) [state was 08001 now 01000]
[unixODBC][FreeTDS][SQL Server]Unknown host machine name. (SQL-01000)
 
 

_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Web OK, command-line.. not yet!

Nick Gorham-2
On 07/07/14 16:50, Jean-Roch Grenetier wrote:
Hello,
 
It's probably a simple one, I think the visibility of .odbc.ini
 
- everything works from Web requests on our Apache-Modperl server. It knows where to find /web/.odbc.ini
 
- but from the command-line calling the same modperl program than the Web request do, I've got an 'Unknown host machine name'. I've copied .odbc.ini pretty much everywhere, so that it be visible to this command-line user. Hint: all other classical Perl DBI connections work from both Web requests and command-line.
 
DBI connect('db_one','optimus',...) failed: [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (SQL-08001) [state was 08001 now 01000]
[unixODBC][FreeTDS][SQL Server]Unknown host machine name. (SQL-01000)
 

Try setting ODBCINI to the ini file you want to use.

TBH, I think the above shows the problem is in the driver, as unixODBC is loading the driver and it looks like the drive is failing to load the value from the ini file. If unixODBC was failing to load the info from the ini it would have failed to load the driver.

--
Nick

_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Web OK, command-line.. not yet!

barsalou
Nick,

I know you fixed this, but could it be the problem with the format of  
the ini file is "wrong"?

Don't remember the exact details, but something to do with where the  
brackets for each section are in the line or spacing of some  
sort...I'll have to dig through my archives to try and find what we  
ended up doing to fix that issue.

Mike B.
Quoting Nick Gorham <[hidden email]>:

> On 07/07/14 16:50, Jean-Roch Grenetier wrote:
>> Hello,
>>
>> It's probably a simple one, I think the visibility of .odbc.ini
>>
>> - everything works from Web requests on our Apache-Modperl server.  
>> It knows where to find /web/.odbc.ini
>>
>> - but from the command-line calling the same modperl program than  
>> the Web request do, I've got an 'Unknown host machine name'. I've  
>> copied .odbc.ini pretty much everywhere, so that it be visible to  
>> this command-line user. Hint: all other classical Perl DBI  
>> connections work from both Web requests and command-line.
>>
>> DBI connect('db_one','optimus',...) failed: [unixODBC][FreeTDS][SQL  
>> Server]Unable to connect to data source (SQL-08001) [state was  
>> 08001 now 01000]
>> [unixODBC][FreeTDS][SQL Server]Unknown host machine name. (SQL-01000)
>>
>
> Try setting ODBCINI to the ini file you want to use.
>
> TBH, I think the above shows the problem is in the driver, as  
> unixODBC is loading the driver and it looks like the drive is  
> failing to load the value from the ini file. If unixODBC was failing  
> to load the info from the ini it would have failed to load the driver.
>
> --
> Nick


_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Web OK, command-line.. not yet!

Matt Phipps
In reply to this post by Jean-Roch Grenetier
Don't remember the exact details, but something to do with where the brackets for each section are in the line or spacing of some sort...I'll have to dig through my archives to try and find what we ended up doing to fix that issue.

Lorenzo Milesi found that "odbcinst -i -s -f /etc/odbc.ini" helped get rid of a problem in odbc.ini. Might be a red herring, but worth a shot.

-Matt

_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Web OK, command-line.. not yet!

Jean-Roch Grenetier
Hello,
 
The ODBCINI did it:
 
ODBCINI=/web/.odbc.ini
export ODBCINI
 
So this now works from both Web and Linux command-line over the same Perl program!
 
However strangely, from the command-line I can't use the '?' placeholder, can't use parameterized statements. 
It produces a 'Segmentation fault' immediately as soon as on the $sth->prepare .
 
This is fine I can live with that, and since the statement returns only one record, I've got the opportunity to bypass the $sth prepare and execute altogether, going with the $dbh directly:
($this, $that, $other) = $dbh->selectrow_array(" SELECT * FROM .." )
 
Not sure which is faster of the 2 (parameterized '?' over direct $dbh) over batches of a few thousands records but this is not essential.
 
Many thanks all!
 

Date: Thu, 10 Jul 2014 10:58:10 -0400
From: [hidden email]
To: [hidden email]
Subject: Re: [unixODBC-support] Web OK, command-line.. not yet!

Don't remember the exact details, but something to do with where the brackets for each section are in the line or spacing of some sort...I'll have to dig through my archives to try and find what we ended up doing to fix that issue.

Lorenzo Milesi found that "odbcinst -i -s -f /etc/odbc.ini" helped get rid of a problem in odbc.ini. Might be a red herring, but worth a shot.

-Matt

_______________________________________________ unixODBC-support mailing list [hidden email] http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support

_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Loading...