Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Connect Catalyst app to MS SQL Server 2005

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


tech at swattermatter

May 27, 2009, 12:44 PM

Post #1 of 2 (586 views)
Permalink
Connect Catalyst app to MS SQL Server 2005

I'm trying to connect my Catalyst app to a MS SQL server 2005. I have
DBIx::Class loaded and I went through the documentation, but I can't
seem to get the right connection string. Would someone be able to point
out my mistake and suggest the proper connection string?

Here is the info from my .conf file.

<Model::DB>
schema_class WebTest::Schema
<connect_info>
dsn dbi:odbc:WebTestODBC
user WebGuy
password webtest
AutoCommit 1
</connect_info>
M/Model::DB>

I have created an ODBC connection called WebTestODBC on the machine
hosting the MSSQL server.
I have also tried the above with a change to the dsn:
dsn dbi:MSSQL:WebTestODBC

But I always get the same error:

DBIx::Class::ResultSet::first(): DBI Connection failed: Can't connect to
data source 'HASH(0x43477e8)' because I can't work out what driver to
use (it doesn't seem to contain a 'dbi:driver:' prefix and the
DBI_DRIVER env var is not set) at
C:/Perl/site/lib/DBIx/Class/Storage/DBI.pm line 839

This suggests that it is not reading the <connect_info> properly and
instead is looking at the entire thing as a hash. I don't know how to
get around this. I don't even know if it is the right assumption.

Also, in my \Model\DB.pm I have the following code I took from the
Catalyst tutorial and modified. I'm not sure if I should just remove it
or what.

__PACKAGE__->config(
schema_class => 'WebTest::Schema',
connect_info => [
'dbi:odbc:WebTestODBC',
],
);

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


plu at pqpq

May 27, 2009, 12:53 PM

Post #2 of 2 (517 views)
Permalink
Re: Connect Catalyst app to MS SQL Server 2005 [In reply to]

On 27.05.2009, at 21:44, Ascii King wrote:

> <Model::DB>
> schema_class WebTest::Schema
> <connect_info>
> dsn dbi:odbc:WebTestODBC
> user WebGuy
> password webtest
> AutoCommit 1
> </connect_info>
> M/Model::DB>

<Model::DB>
schema_class WebTest::Schema
connect_info dbi:odbc:WebTestODBC
connect_info WebGuy
connect_info webtest
<connect_info>
AutoCommit 1
</connect_info>
</Model::DB>

... should do the trick. See also: http://search.cpan.org/dist/Catalyst-Model-DBIC-Schema/lib/Catalyst/Model/DBIC/Schema.pm#CONFIG_PARAMETERS

Cheers,
plu

--
Johannes Plunien | mailto:plu [at] pqpq | http://www.pqpq.de/contact/
Attachments: smime.p7s (2.38 KB)

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.