List:General Discussion« Previous MessageNext Message »
From:Colin McKinnon Date:March 25 1999 10:17am
Subject:Re: DBI - basic question
View as plain text  
At 11:38 24/03/99 -0600, Albert wrote:
>Hi All,
>I am a newbee with SQL  just getting my feet wet with it.  I
>have a few questions.
>
>I have data that will take about 30,000 rows.   If I throw
>it all into one table will my performance suffer alot?
Depends - without indexing, the time taken to retreive a particular row
will increase with the number of records (N). If you can specify in advance
which row you want (using WHERE clause), and it is indexed, it will be
found in Log(N) units of time. So what does that mean? Well, 30,000 rows is
not a LARGE table (unless your rows are very large) so it should be quite
fast. Look in the archive for learning resources on SQL. Also, get hold of
the manual from the TCX website if you haven't already done so.

>Also I am not able to make a connection to my database using
>DBI
>here is the snippet of code I am using to connect, can
>anyone see what is wrong with it?
>
>The error I get is Can't connect to MySQL server on
>localhost (61)
>my isp has the mysql servers on dedicated machines.  So I
>don't think the hostname is localhost?
I should point out that I know next to nothing about PERL and so far
haven't managed to get DBI/DBD set up on my machine, so I'll leave it to
someone else to comment on how good your code is....

The security on MySQL databases is (IMHO) not very easy to set up (but
better since GRANT became available). Note that although you may be
identified by your login name at your ISP, they also need to setup
permission to access the DBMS from particular hosts. Also, MySQL maintains
a seperate password list from the OS, therefore you may have a different
password for MySQL.

...Sorry if this is terribly obvious - I'm not quite clear what you meant
about your ISPs setup...

The hostname will be localhost if the script is running on the same host as
the MySQL DBMS. If you have telnet access, ask your ISP if you can run the
'mysql' program (not the MySQL server - mysqld) - this is an interactive
shell in which you can enter SQL commands and see the results. See man
mysql for more info. This is probably quicker for testing than writing and
debugging code.

HTH
Colin
>------------------------------------------
>#!/usr/local/bin/perl5 -w
>
>  print "Content-type: text/html\n\n";
>
> use DBI;
>$drh = DBI->install_driver( 'mysql' );
>$dbh = $drh->connect(
>'hostname','databasename','myusername','mypassowrd' ) ;
> print "Cannot connect: $DBI::errstr\n"  unless $dbh;
>$dbh->disconnect;
> exit;
>------------------------------------------
>
>Thanks for all the help!!
>Albert


Thread
DBI - basic questionAlbert24 Mar
  • Re: DBI - basic questionColin McKinnon25 Mar
  • Re: Replication Bug in 3.23.33Sasha Pachev14 Feb
Re: Replication Bug in 3.23.33Sasha Pachev14 Feb