[Catalyst] Newbie Question about Database
Hi: I'm building an App but I want to have my database in another IP. Is there a way to enter the parameters to do this instead of the normal connection that appears in the manual? This is my model (a very standar one): package App::Model::ModelDB; use strict; use base 'Catalyst::Model::DBIC::Schema'; __PACKAGE__->config( schema_class => 'App::Schema::ModelDB', connect_info => [ 'dbi:mysql:model', 'model', 'model', { mysql_enable_utf8 => 0, on_connect_do => [ "SET NAMES 'utf8'", "SET CHARACTER SET 'utf8'", ], } ], ); How can I change it to connect to a DB in another IP? TIA, Giancarlo ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Newbie Question about Database
connect_info => [ 'dbi:mysql:model', This is a mysql question. DBI passes the connection line is mysql. See here for an example of what you can write in it, but I cannot confirm, not being a mysl user: http://www.apachefriends.org/f/viewtopic.php?f=16&t=27481 Look for any examples of mysql connection in DBI manuals. --Gene ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Newbie Question about Database
On Mon, Jan 19, 2009 at 3:10 PM, Giancarlo Corcuera wrote: > Hi: > > I'm building an App but I want to have my database in another IP. Is there a > way to enter the parameters to do this instead of the normal connection that > appears in the manual? > > This is my model (a very standar one): > > package App::Model::ModelDB; > > use strict; > use base 'Catalyst::Model::DBIC::Schema'; > > __PACKAGE__->config( > schema_class => 'App::Schema::ModelDB', > connect_info => [ > 'dbi:mysql:model', > 'model', > 'model', > { > mysql_enable_utf8 => 0, > on_connect_do => [ > "SET NAMES 'utf8'", > "SET CHARACTER SET 'utf8'", > ], > } > ], > ); > > How can I change it to connect to a DB in another IP? > You probably want to do this in the config, something like this: If the config is yaml Model::ModelDB: connect_info: - 'dbi:mysql:dbname=my_db_name;host=my_host_or_ip' - 'my_dbuser' - 'my_dbpass' - AutoCommit: 1 mysql_auto_reconnect: 0 Or if the config is conf connect_info dbi:mysql:dbname=my_db_name;host=my_host_or_ip connect_info my_dbuser connect_info my_dbpass AutoCommit 1 mysql_auto_reconnect 0 Thanks, John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Newbie Question about Database
John Goulah wrote: > On Mon, Jan 19, 2009 at 3:10 PM, Giancarlo Corcuera > wrote: > >> Hi: >> >> I'm building an App but I want to have my database in another IP. Is there a >> way to enter the parameters to do this instead of the normal connection that >> appears in the manual? >> >> This is my model (a very standar one): >> >> package App::Model::ModelDB; >> >> use strict; >> use base 'Catalyst::Model::DBIC::Schema'; >> >> __PACKAGE__->config( >> schema_class => 'App::Schema::ModelDB', >> connect_info => [ >> 'dbi:mysql:model', >> 'model', >> 'model', >> { >> mysql_enable_utf8 => 0, >> on_connect_do => [ >> "SET NAMES 'utf8'", >> "SET CHARACTER SET 'utf8'", >> ], >> } >> ], >> ); >> >> How can I change it to connect to a DB in another IP? >> >> > > > You probably want to do this in the config, something like this: > > If the config is yaml > > Model::ModelDB: > connect_info: > - 'dbi:mysql:dbname=my_db_name;host=my_host_or_ip' > - 'my_dbuser' > - 'my_dbpass' > - AutoCommit: 1 > mysql_auto_reconnect: 0 > > > Or if the config is conf > > > connect_info dbi:mysql:dbname=my_db_name;host=my_host_or_ip > connect_info my_dbuser > connect_info my_dbpass > > AutoCommit 1 > mysql_auto_reconnect 0 > > > > > > Thanks, > John > > ___ > List: Catalyst@lists.scsys.co.uk > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ > Dev site: http://dev.catalyst.perl.org/ > > > I recommend that you also install the MySQL client software (not necessarily the whole database engine, but the client component only) on your computer and then first try to connect to the MySQL server you are interested in using the MySQL client. That lets you test your connectivity before you code that into the Catalyst configuration. It is also great for testing out your SQL statements if you are shaky on SQL like me. I also wonder if Catalyst can make use of a .my.cnf file if there is one. Why is this important? Because you can keep your connection password private. Bob Cochran ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Newbie Question about Database
Good afternoon, On 19/01/09 at 8:11 PM -0500, Robert L Cochran wrote: I also wonder if Catalyst can make use of a .my.cnf file if there is one. Why is this important? Because you can keep your connection password private. You can pass a path to a "user defaults" file as part of the DBI connect string. I don't recall the syntax though. Charlie -- Charlie Garrison PO Box 141, Windsor, NSW 2756, Australia O< ascii ribbon campaign - stop html mail - www.asciiribbon.org http://www.ietf.org/rfc/rfc1855.txt ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Newbie Question about Database
On Jan 19, 2009, at 7:06 PM, Charlie Garrison wrote: Good afternoon, On 19/01/09 at 8:11 PM -0500, Robert L Cochran wrote: I also wonder if Catalyst can make use of a .my.cnf file if there is one. Why is this important? Because you can keep your connection password private. You can pass a path to a "user defaults" file as part of the DBI connect string. I don't recall the syntax though. This is how I usually do it. The __path_to()__ in configs gets expanded properly. Model::DBIC: schema_class: MyApp::Schema connect_info: - dbi:mysql:myappdb;mysql_read_default_file=__path_to (etc/.mysql.cnf)__ - ~ - ~ - RaiseError: 1 PrintError: 0 AutoCommit: 1 ChopBlanks: 1 -Ashley ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Newbie Question about Database
Ashley wrote: On Jan 19, 2009, at 7:06 PM, Charlie Garrison wrote: Good afternoon, On 19/01/09 at 8:11 PM -0500, Robert L Cochran wrote: I also wonder if Catalyst can make use of a .my.cnf file if there is one. Why is this important? Because you can keep your connection password private. You can pass a path to a "user defaults" file as part of the DBI connect string. I don't recall the syntax though. This is how I usually do it. The __path_to()__ in configs gets expanded properly. Model::DBIC: schema_class: MyApp::Schema connect_info: - dbi:mysql:myappdb;mysql_read_default_file=__path_to(etc/.mysql.cnf)__ - ~ - ~ - RaiseError: 1 PrintError: 0 AutoCommit: 1 ChopBlanks: 1 -Ashley ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ Thank you all for your answers: Actually, what I did is to follow the basic instructions from mysql forum but what I was missing is to set the user with full access from any host, which I created later from phpmyadmin. Regards, Giancarlo ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Newbie Question about Database
On Tue, Jan 20, 2009 at 09:08:31AM -0500, Giancarlo Corcuera wrote: > Thank you all for your answers: > Actually, what I did is to follow the basic instructions from mysql > forum but what I was missing is to set the user with full access from > any host, which I created later from phpmyadmin. full access? any host? this makes me nervous (for you and your data) -- Chisel Wright e: chi...@herlpacker.co.uk w: http://www.herlpacker.co.uk/ Two Eskimos sitting in a kayak were chilly; but when they lit a fire in the craft, it sank, proving once and for all that you can't have your kayak and heat it. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Newbie Question about Database
Chisel Wright wrote: On Tue, Jan 20, 2009 at 09:08:31AM -0500, Giancarlo Corcuera wrote: Thank you all for your answers: Actually, what I did is to follow the basic instructions from mysql forum but what I was missing is to set the user with full access from any host, which I created later from phpmyadmin. full access? any host? this makes me nervous (for you and your data) lol I know but I'm doing this inside a private lan where we are building this app with my coleagues :p of course later on we will have specific accounts with limited access ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Newbie Question about Database
Giancarlo Corcuera wrote: > > > Chisel Wright wrote: >> On Tue, Jan 20, 2009 at 09:08:31AM -0500, Giancarlo Corcuera wrote: >> >>> Thank you all for your answers: >>> Actually, what I did is to follow the basic instructions from mysql >>> forum but what I was missing is to set the user with full access >>> from any host, which I created later from phpmyadmin. >>> >> >> full access? any host? this makes me nervous (for you and your data) >> >> > lol I know but I'm doing this inside a private lan where we are > building this app with my coleagues :p > of course later on we will have specific accounts with limited access Your colleagues can be your biggest security problem. It just takes an argument...a jealousy...someone who feels belittled...someone who just wants to take advantage of lax data security. It is real good practice to use least-privilege access to data from the very beginning. Bob ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Newbie Question about Database
> > lol I know but I'm doing this inside a private lan where we are > > building this app with my coleagues :p > > of course later on we will have specific accounts with limited access > > Your colleagues can be your biggest security problem. It just takes an > argument...a jealousy...someone who feels belittled...someone who just > wants to take advantage of lax data security. It is real good practice > to use least-privilege access to data from the very beginning. > > Exactly, also how many of those "we will of course do X later..." TODO's end up hanging out there forever. -- Thanks! Wade Stuart Phone: 917-363-6164 IM: SpaceMuscles ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/