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:
connecting to mSQL

 



monocle
User

Apr 9, 2001, 11:31 AM

Post #1 of 5 (311 views)
connecting to mSQL Can't Post

OK... I am having a heck of a time connecting to my mSQL server in my PERL script. I can telnet in and everything connects fine, but I can not for the life of me get my script to connect. I have started out slow by just trying to connect and list the DBs present, but that just won't work. Any one have any suggestions?

my script:
#!/usr/bin/perl -w
#*********************************************************************************#
# Begin Declarations

use Msql;
print "Content-type: text/html\n\n";

$host = "netamorphic.com";
my $dbh = Msql->connect($host) || print "no connect
\n";

@arr = $dbh->listdbs();
print join "
\n", @arr;

print "done";

exit;

I have tried every possible entry for $host that I can think of, but nothing wants to connect. What is it looking for in $host? I assume it is my domain, but how can I deteremine the "host" I should be connecting to? No errors are thrown with this code. If I try to select a DB, then I get an error about "unable to connect to host" or "Unknown Host name". I know there are DBs present because I created then via Telnet access.

This is really getting me down. I have scoured the web for examples and read and reread my mSQL book using PERL. I am sure there is just something I am overlooking. Can anyone offer any insite?



James
Troll

Apr 9, 2001, 4:32 PM

Post #2 of 5 (308 views)
Re: connecting to mSQL [In reply to] Can't Post

Have you tried setting your host to 'localhost' ? I would think you'd also have to specify the database name, username, and password somewhere.

To connect to a MySQL database on my server, I'd use:

Code
Mysql->connect('localhost','DATABASENAME','USERNAME','USERPASSWORD');

substituting the appropriate information for DATABASENAME, USERNAME, and USERPASSWORD.

Just guessing that mSQL and your server might use similar syntax.

Your web host ought to be able to give you the correct syntax (assuming you have a web host).



monocle
User

Apr 10, 2001, 4:58 PM

Post #3 of 5 (299 views)
Re: connecting to mSQL [In reply to] Can't Post

yeah, mSQL works just a tiny bit different; username and pasword are ignored.

I have tried "localhost" and many more things. My web host is not being very helpful. It has taken them 2 weeks to get the mSQL server configured right. I can now connect via Telnet but still nothing via Perl script. But I am still not convinced that this is my problem.

The stuff I have read on mSQL tells me that you need not supply a DB name to connect. You should be able to connect and then ask for a list of available DBs. Host is not even required, but it will default to localhost. That did not work for me either.

Thanks for your reply. I am still waiting for an answer from my web host. They really ought to be able to help me on this one. They are just being slow.

monocle




James
Troll

Apr 16, 2001, 11:54 AM

Post #4 of 5 (290 views)
Re: connecting to mSQL [In reply to] Can't Post

Sounds like you need a new web host ;)

J



monocle
User

Apr 17, 2001, 8:50 AM

Post #5 of 5 (284 views)
Re: connecting to mSQL [In reply to] Can't Post

yeah, too late for that... but they are now refusing to give me any more help. I will never recomend AIT to anyone again. They provide cgi-bin access and mSQL server access but provide zero support on using them together.

So that said, I am asking again if anyone knows more about using mSQL. My problem is that when asked for the "host" to connect to, nothing seems to work. I either get an this error "Unknown MSQL Server Host (/usr/local/msql)" or this error "Can't connect to MSQL server on www.netamorphic.com" I would tend to believe that the second error means I have the correct format but for some reason cannot connect to the server. the first error leads me to believe that it is the improper format for host name. but that is what i was given from AIT when asked for the path to connect.. perhaps I asked the wrong question again. silly me. :)

pulling my hair out!

monocle


 
 


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

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