CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
How to use DBIx::Class::Schema::Loader to create schema from an existing MySQL database?

 



david123
New User

Jul 31, 2013, 9:39 PM

Post #1 of 1 (765 views)
How to use DBIx::Class::Schema::Loader to create schema from an existing MySQL database? Can't Post

Greetings,

I am trying to use DBIx::Class::Schema::Loader to create schema from an existing MySQL database. I used the make_schema_at method like this:

C:\xampp\perl\bin>perl -MDBIx::Class::Schema::Loader=make_schema_at,du
+mp_to_dir:.\lib -e "make_schema_at('turboimmisoft::Schema', ['dbi::my
+sql::dbname=t
urboimmisoft', 'root', ''])"
[download]
where: turboimmisoft is the name of my database

I got the following error message:

Reference found where even-sized list expected at C:/xampp/perl/site/l
+ib/DBIx/Class/Schema/Loader.pm line 165.
DBIx::Class::Storage::DBI::_connect(): You did not provide any connect
+ion_info at -e line 1
[download]
I am using ActivePerl 5.14.4 on Windows Vista and the path the the MySQL database is: "C:\xampp\mysql\data\". The path to perl.exe is: "C:\xampp\perl\bin\"

To connect to the MySQL database with DBI (not DBIx::Class), I use:

use DBI;
my $driver = "mysql";
my $database = "turboimmisoft";
my $dsn = "DBI:$driver:database=$database";
my $userid = "root";
my $password = "";
my $dbh = DBI->connect($dsn, $userid, $password) #, {RaiseError => 1
+, AutoCommit => 1}
or die "Could not connect to database:$DBI::errstr";
[download]
Any help will be appreciated. I am new to DBIx::Class but I have been using DBI since 2007.

Do I have to create new folders in the DBIx::Class folder for the new schema?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives