Click to See Complete Forum and Search --> : Database on Linux
jman_77
05-28-2001, 08:49 PM
Okay, so I'm learning database programming here, and this is really cool, but I have some questions about doing this in a Linux environment.
I've been using *sigh* Access to create the database, ASP pages to interact with the db and generate pages, and miscrosoft's DSN to link it all together.
So my question is, is there any hope of using this on a linux platform or will I have to throw everything out and reprogram? And what would I use to develop everything? (php, mysql, ?)
thanks everyone
Energon
05-28-2001, 09:06 PM
To do it best in Linux, you'd have to use MySQL (or one of the other popular db systems) and PHP... ASP and Access won't work unless you want to spend many moons reading and reading...
jman_77
05-28-2001, 10:10 PM
so I guess the only thing I'm not clear on is what I use to create the database. Is there some kind of authoring tool with MySQL or will I have to use some kind of third party software (like access)?
sorry, this is all new to me :)
thanks
Energon
05-28-2001, 11:15 PM
CREATE DATABASE db_name;
that command there, in MySQL, will create you a database called db_name... :)
It's, for the most part, done with plain old SQL commands (there are some MySQL specific ones, but not many)... you just don't get the fancy point and click way of doing it unless you hunt around for the utilities to do so...
jman_77
05-28-2001, 11:32 PM
Ouch... well.. price you pay for not coughing up the few grand for a windows server or cold fusion's linux server (5 grand? they're kidding, right?)
thanks for pointing me in the right direction
klamath
05-29-2001, 12:13 AM
You can also use PostgreSQL, which has (IMHO) a lot of advantages over MySQL. There are GUI interfaces to both of them, such as PgAccess for PostgreSQL, but I'd recommend sticking with plain SQL, it's easy.
BTW, the SQL standard is a bit... wacky -- each database implements it slightly differently (PgSQL is mostly standards-compliant, MySQL less so). So your code should be mostly portable from one database engine to another, but not entirely. The documentation for your RDBMS should include a description of the SQL statements it implements and their behavior.
Also, there is a big difference between something like ColdFusion and an RDBMS like PostgreSQL or MySQL.
There's a product by ChiliSoft (forget the name) which allows you to run ASP under Linux and you could connect to an MS SQL server running on a different host, but I'd say just ditch the MS setup and use a UNIX based one.
I'd strongly suggest looking into Perl. It's very good for web development.
jman_77
05-29-2001, 01:31 AM
I really like perl but I'm not sure of it's capabilities for generating content on the fly, which is basically what I'm doing right now with ASP. I'm aware the same result can be achieved with PHP in linux, but I'm not sure how it would be done with perl.
For instance, a user requests a list of all available products. Well, I can just write an asp script to query the database and format everything appropriately. Very handy. Can I do the same thing with perl? any good resources on this?
klamath
05-29-2001, 02:25 AM
Yes, that's very easy in Perl. You have 2 main ways to do it:
1) CGI-like: Code is executed by the webserver (either an external Perl script (CGI) or Perl code embedded in the web-server process (mod_perl -- this is much faster)). This code does whatever database magic it needs and then prints out an HTML page with the results
2) ASP-like: You use a package like HTML::Mason, Template Toolkit, HTML::EmbPerl, or others to construct Perl 'templates' -- HTML files with Perl code in special sections. When the web server receives a request for a template file, it is configured to parse the template (possibly caching the results for performance) and return the resulting HTML. In your template, you write code to fetch data from the database and format it.
So I would say that Perl can do everything PHP can and a lot more. Perhaps for a small subset of things, Perl's not quite as 'fool-proof', but IMHO, it's more powerful and useful in the long run.
jemfinch
05-29-2001, 12:01 PM
Originally posted by klamath:
1) CGI-like: Code is executed by the webserver (either an external Perl script (CGI) or Perl code embedded in the web-server process (mod_perl -- this is much faster)). This code does whatever database magic it needs and then prints out an HTML page with the results
Of course, if you go this route, there are, IMO, better languages than Perl, such as Python.
2) ASP-like: You use a package like HTML::Mason, Template Toolkit, HTML::EmbPerl, or others to construct Perl 'templates' -- HTML files with Perl code in special sections. When the web server receives a request for a template file, it is configured to parse the template (possibly caching the results for performance) and return the resulting HTML. In your template, you write code to fetch data from the database and format it.
I don't believe Python has anything similar to this (though I really can't say.) HTML::Mason is the most interest of these perl version of ASP/PHP, though. In all honesty, though, if embedded code is what you're going for, PHP may in fact be a better choice than Perl. I've looked at all the other options at one point and none appeared nearly as "clean" as PHP.
So I would say that Perl can do everything PHP can and a lot more. Perhaps for a small subset of things, Perl's not quite as 'fool-proof', but IMHO, it's more powerful and useful in the long run.
That's true, but the same can be said of Python when compared to Perl (except that I can't think of any place where Perl is more fool-proof than Python.)
These are, of course, my opinions. But you'll have a hard time finding anyone on this board who knows both Perl and Python and would still suggest Perl to a newbie.
Jeremy
EscapeCharacter
05-29-2001, 12:29 PM
this is kinda off topic but ive been wondering this since i started my oracle class, does postgres support pl/sql?
Mikey123
05-29-2001, 04:49 PM
If you are comfortable with, and like ASP as an embedded solution then php is probably going to be your best bet. If you don't understand Apache/mod_perl then there are all kinds of traps using most embedded perl solutions. I personally use perl/mod_perl for most of my applications but I think you will find php easier to work with at first.
klamath
05-29-2001, 06:19 PM
does postgres support pl/sql?
It supports its own procedural language (Pl/PgSQL), which is similar to Oracles. It also allows you to write functions in SQL, C, Tcl, Perl, Python, Ruby, etc...
If you don't understand Apache/mod_perl then there are all kinds of traps using most embedded perl solutions.
Which traps?
But you'll have a hard time finding anyone on this board who knows both Perl and Python and would still suggest Perl to a newbie.
I believe the original poster is a newbie to database programming, but it already familiar with Perl ("I really like Perl..." in a message above).