Maybe we need to know why you want to do this? If its to create a command line script using your existing connections then you should consider looking at using symfony tasks: http://www.symfony-project.org/cookbook/1_1/en/tasks
The advantage of tasks is that you can then leverage off all the symfony library code very easily without trying to "hack" your way through it. <http://www.symfony-project.org/cookbook/1_1/en/tasks>If its not for that reason, why not tell us and I am sure there would be a better and existing way to do so in symfony that you may not have come across. On Fri, Apr 15, 2011 at 5:48 PM, codecowboy <l...@lukem.co.uk> wrote: > Hi, > > I need to connect to a second database from my Symfony (1.4/Doctrine) > application but don't want to use the ORM to connect to the other db. > I can connect like this: > > $dsn = 'mysql:host=test;dbname=test'; > $user = 'user'; > $password = 'pass'; > > $dbh = new PDO($dsn, $user, $password); > $conn = Doctrine_Manager::connection($dbh); > > $client_id = 103; > $body = 'Test post 2 from My App'; > > // query > $sql = "INSERT INTO posts (client_id,body,date) VALUES > (:client_id,:body,NOW())"; > $q = $conn->prepare($sql); > $q->execute(array(':client_id'=>$client_id, > ':body'=>$body)); > > Does anyone know how I can read in the connection info rather than > setting it manually? I have tried $conn = > DoctrineManager::connection('name of connection') but I get a parsing > error. > > Thanks! > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony users" group. > To post to this group, send email to symfony-users@googlegroups.com > To unsubscribe from this group, send email to > symfony-users+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en > -- Gareth McCumskey http://garethmccumskey.blogspot.com twitter: @garethmcc identi.ca: @garethmcc -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en