Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » How to connect to my local database server
How to connect to my local database server [message #662104] Tue, 29 March 2011 06:43 Go to next message
No real name is currently offline No real name
Messages: 6
Registered: March 2011
Junior Member
Hi,
I am new to Eclipse PDT.
I want to make database applications with php and Mysql.
But I do not know how to connect Eclipse with my local database server.
I thought that this command would do the job but it didn't work.
mysql_connect("localhost","username","password");
I take the following error:
PHP Fatal error: Call to undefined function mysql_connect() in /home/pinkonomy/workspace/aaa/soc.php on line 4

Any suggestions please?
Is there any plug in that connects Eclipse PDT with the database server?

Thanks for your time.

[Updated on: Tue, 29 March 2011 06:50]

Report message to a moderator

Re: How to connect to my local database server [message #662114 is a reply to message #662104] Tue, 29 March 2011 08:13 Go to previous messageGo to next message
dominik is currently offline dominik
Messages: 122
Registered: July 2009
Senior Member
On 2011-03-29 12:43, pinkonomy@gmail.com wrote:
> Hi,
> I am new to Eclipse PDT.
> I want to make database application with php and Mysql.
> But I do not know how to connect Eclipse with my local database server.
> I thought that this command would do the job but it didn't work.
> mysql_connect("localhost","username","password");

Is same thing working from console?
What is the result of this command?
If not please double check Your connection settings.


> Any suggestions please?
> Is there any plug in that connects Eclipse PDT with the database server?

Few, some are commercial,
There is quite good:

DBViewer Plugin 1.2.2.v20101009 zigen.plugin.future.feature.group

but once You learn to use console then You will never use anything else.

/dmc
Re: How to connect to my local database server [message #662116 is a reply to message #662114] Tue, 29 March 2011 08:21 Go to previous messageGo to next message
No real name is currently offline No real name
Messages: 6
Registered: March 2011
Junior Member
No,from the console when I write : mysql -uusername -ppassword I can connect to my database server.
Re: How to connect to my local database server [message #662133 is a reply to message #662116] Tue, 29 March 2011 09:15 Go to previous messageGo to next message
dominik is currently offline dominik
Messages: 122
Registered: July 2009
Senior Member
On 2011-03-29 14:21, pinkonomy@gmail.com wrote:
> No,from the console when I write : mysql -uusername -ppassword I can connect
> to my database server.

Ok, so server is running correctly.

According to manual:
mysql_connect (...) Returns a MySQL link identifier on success or FALSE on failure.

what is the result of something like this?

$conn = mysql_connect(...);
var_dump($conn, mysql_error());

Connection error will be reported by mysql_error.
If connection works from console then it should from php, eclipse has nothing to
that.

/dmc
Re: How to connect to my local database server [message #662135 is a reply to message #662133] Tue, 29 March 2011 09:32 Go to previous messageGo to next message
No real name is currently offline No real name
Messages: 6
Registered: March 2011
Junior Member
I take again the same error:PHP Fatal error: Call to undefined function mysql_connect() in /home/pinkonomy/workspace/aaa/soc.php on line 3

I also googled it and found that I should uncomment the
extension=mysql.so in php.ini.
I also did it but nothing worked for me.
Re: How to connect to my local database server [message #662148 is a reply to message #662135] Tue, 29 March 2011 10:14 Go to previous messageGo to next message
No real name is currently offline No real name
Messages: 6
Registered: March 2011
Junior Member
Anyone else help me?
Re: How to connect to my local database server [message #662644 is a reply to message #662135] Thu, 31 March 2011 08:00 Go to previous messageGo to next message
dominik is currently offline dominik
Messages: 122
Registered: July 2009
Senior Member
On 2011-03-29 15:32, pinkonomy@gmail.com wrote:
> I take again the same error:PHP Fatal error: Call to undefined function
> mysql_connect() in /home/pinkonomy/workspace/aaa/soc.php on line 3
>
> I also googled it and found that I should uncomment the extension=mysql.so in
> php.ini.
> I also did it but nothing worked for me.

Run phpinfo() and make sure that You configured mysql properly, if not google
again for some tutorials. This is not PDT or Eclipse related problem, so this is
not best place to ask for some system related advices.

best regards

/dmc
Re: How to connect to my local database server [message #777179 is a reply to message #662644] Mon, 09 January 2012 20:25 Go to previous messageGo to next message
Francisco Marzoa is currently offline Francisco Marzoa
Messages: 11
Registered: January 2012
Junior Member
I am not so sure about not being an Eclipse nor PDT issue. I have the same problem today with an script that fails similar way but just when running into Eclipse. When invoked from command line it works fine. So I think its clear an Eclipse/PDT issue.
Re: How to connect to my local database server [message #778061 is a reply to message #777179] Wed, 11 January 2012 06:08 Go to previous message
dominik is currently offline dominik
Messages: 122
Registered: July 2009
Senior Member
On 2012-01-10 02:25, Francisco Marzoa wrote:
> I am not so sure about not being an Eclipse nor PDT issue. I have the same
> problem today with an script that fails similar way but just when running into
> Eclipse. When invoked from command line it works fine. So I think its clear an
> Eclipse/PDT issue.

Most such problems are caused by configuration, so first be sure that your have
needed module. CLI usually uses different configuration or even different
version of PHP.

Of course you can be right about this issue, but first check simple things :)

/dmc
Previous Topic:PDT 3.0.2 Eclipse Update Site ?
Next Topic:mysql_connect undefined when running script from Eclipse
Goto Forum:
  


Current Time: Wed Aug 27 15:27:16 EDT 2014

Powered by FUDForum. Page generated in 0.03524 seconds