DBD:ODBC question. 
Author Message
 DBD:ODBC question.

Hi, all...
I was hoping someone might be able to help with this question.  I've been
experimenting with database access using DBI and DBD:ODBC, and it's working
on my local machine here.  Is it possible to access a database on another
machine/host, however?

The ODBC "connect" function's $data_source string seems to only accept one
format (at least, I can't find anything else...) - "DBI:ODBC:<dsn-name>",
where <dsn-name> is the DSN I've set up from the ODBC control panel.  Is
there a way to say something like:

$dbh->connect("DBI:ODBC:host=foo.bar.com;port=x;dsn=<dsn-name>",$user,$pass)
; ?

I'd like to have some database access from another machine.  Any help would
be appreciated - thanks!
Mike.



Mon, 16 Apr 2001 03:00:00 GMT  
 DBD:ODBC question.

Quote:

> Hi, all...
> I was hoping someone might be able to help with this question.  I've been
> experimenting with database access using DBI and DBD:ODBC, and it's working
> on my local machine here.  Is it possible to access a database on another
> machine/host, however?

> The ODBC "connect" function's $data_source string seems to only accept one
> format (at least, I can't find anything else...) - "DBI:ODBC:<dsn-name>",
> where <dsn-name> is the DSN I've set up from the ODBC control panel.  Is
> there a way to say something like:

> $dbh->connect("DBI:ODBC:host=foo.bar.com;port=x;dsn=<dsn-name>",$user,$pass)
> ; ?

I'm hardly an expert in ODBC, but I think the answer lies in defining your DSN
properly. Exactly how this is done will depend on your particular ODBC driver
etc. I'm currently working with ODBC to a remote Oracle machine and all I
specify is

    DSN=$odbcalias;UID=$dbuid;PWD=$dbpwd

--
================================================================




Tue, 17 Apr 2001 03:00:00 GMT  
 DBD:ODBC question.

Quote:


> > I was hoping someone might be able to help with this question.  I've been
> > experimenting with database access using DBI and DBD:ODBC, and it's working
> > on my local machine here.  Is it possible to access a database on another
> > machine/host, however?

> > The ODBC "connect" function's $data_source string seems to only accept one
> > format (at least, I can't find anything else...) - "DBI:ODBC:<dsn-name>",
> > where <dsn-name> is the DSN I've set up from the ODBC control panel.  Is
> > there a way to say something like:

> > $dbh->connect("DBI:ODBC:host=foo.bar.com;port=x;dsn=<dsn-name>",$user,$pass)
> > ; ?

> I'm hardly an expert in ODBC, but I think the answer lies in defining your DSN
> properly. Exactly how this is done will depend on your particular ODBC driver
> etc. I'm currently working with ODBC to a remote Oracle machine and all I
> specify is

>     DSN=$odbcalias;UID=$dbuid;PWD=$dbpwd

Like Terry says:
You need to create an ODBC-DSN for the remote database on your local
computer. So create a new ODBC data source (e.g. named ABC) and use the
configuration dialog to specify the remote host (at least this is the
way to do it for MS SQLServer). Then you just can call
  $dbh->connect("DBI:ODBC:ABC",$user,$pass)
without bothering whether ABC is a local or remote data source.

The downside is: you have to create this data source on every computer
your script is going to run.

Yours
  Hendrik

Pursuant to US Code, Title 47, Chapter 5, Subchapter II, Sec. 227,
any and all unsolicited commercial E-mail sent to this address
is subject to a download and archival fee in the amount of $500
US (per infraction).  E-mailing denotes acceptance of these terms.

--
Hendrik W"ordehoff         |s  |d &|m  |  software design & management
                           |   |   |   |  GmbH & Co. KG                :

Tel/Fax (089) 63812-337/515               81737 M"unchen               :



Tue, 17 Apr 2001 03:00:00 GMT  
 DBD:ODBC question.

Quote:

>Like Terry says:
>You need to create an ODBC-DSN for the remote database on your local
>computer. So create a new ODBC data source (e.g. named ABC) and use the
>configuration dialog to specify the remote host (at least this is the
>way to do it for MS SQLServer). Then you just can call
>  $dbh->connect("DBI:ODBC:ABC",$user,$pass)
>without bothering whether ABC is a local or remote data source.

>The downside is: you have to create this data source on every computer
>your script is going to run.

Okay - (thanks for the info.)... I went to the ODBC control panel and tried
setting up a DSN (for example, using an Access driver), but didn't know
where to specify the remote host itself - unless it was on the local
(Windows) network (ie. I couldn't set an Internet URL).  Is that the only
way to do it remotely, then? :P

Thanks again,
Michael.



Tue, 17 Apr 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. DBD::ODBC questions...

2. DBI/DBD:ODBC question

3. DBD:ODBC Question (remote access?)

4. DBD::ODBC question

5. MS Access, Linux, DBI, DBD::ODBC, Easysoft's ODBC-ODBC Bridge

6. perl DBD-ODBC to Informix question

7. perl/Hyperwave DBI/DBD ODBC + Oracle questions

8. perl/Hyperwave DBI/DBD ODBC + Oracle questions

9. DBD:ODBC basic question

10. DBD::ODBC basic questions

11. perl/Hyperwave DBI/DBD ODBC + Oracle questions

12. DBD:ODBC basic question

 

 
Powered by phpBB® Forum Software