problems with the database connection

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
6/9/2005 11:19:21 AM
Gravatar
Total Posts 2

Re: problems with the database connection

Hi Joe,

I have created a databse with the name mojoportal ( the SQL scripts did not work properly, I had to do a lot of editing). I executed the SQL scripts 1,2,3 and 4, edited the webconfig and placed the MySQL dlls as in the documentation in the Bin folder.
On XSP( windows) I get this error:

MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts ---> System.Net.Sockets.SocketException: No such host is known
in <0x0009f> System.Net.Dns:GetHostByName (System.String hostName)
in <0x0014d> MySql.Data.Common.StreamCreator:GetStream (Int32 timeOut)
in <0x00176> MySql.Data.MySqlClient.NativeDriver:Open ()--- End of inner exception stack trace ---

in <0x001ad> MySql.Data.MySqlClient.NativeDriver:Open ()
in <0x00029> MySql.Data.MySqlClient.Driver:Create (MySql.Data.MySqlClient.MySqlConnectionString settings)
in <0x0008d> MySql.Data.MySqlClient.MySqlPool:CreateNewPooledConnection ()
in <0x001ae> MySql.Data.MySqlClient.MySqlPool:GetPooledConnection ()
in <0x0003f> MySql.Data.MySqlClient.MySqlPool:GetConnection ()
in <0x000e3> MySql.Data.MySqlClient.MySqlPoolManager:GetConnection (MySql.Data.MySqlClient.MySqlConnectionString settings)
in <0x00041> MySql.Data.MySqlClient.MySqlConnection:Open ()

===================================================================================


Using the Sassini web server, I get something similar:


SocketException (0x2af9): No such host is known]
System.Net.Dns.GetHostByName(String hostName) +270
MySql.Data.Common.StreamCreator.GetStream(Int32 timeOut) +231
MySql.Data.MySqlClient.NativeDriver.Open() +278

[MySqlException: Unable to connect to any of the specified MySQL hosts]
mojoPortal.Web.Global.Application_BeginRequest(Object sender, EventArgs e) +568
System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +50
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87


Do you have an idea what exactly I?m doing wrong?

Thanks for your help in advance.
6/9/2005 2:38:51 PM
Gravatar
Total Posts 18439

Re: problems with the database connection

Hi Voltron,

The error you are getting indicates it can't resolve the host name which is a dns issue. Whatever the server name in your connection string is, the name cannot be reolved. If the database is on the same machine as the web server you can use localhost for the server name, if its on a different machine you can try to ping it by name and it will probably give you the same error if it can't resolve the name. If you know the ip address of the machine with MySQL, you can edit your hosts file and add a row like

192.168.0.x       hostname

using whatever the ip address and host name are for the MySQL machine and that will resolve the host name to the ip address

On windows your hosts file should be in Windows\System32\Drivers\etc folder

You may also get an error if the MySQL machine is not configured to allow tcp/ip connections but the error you are getting now is clearly a DNS error.

What version of MySQL are you using and what did you have to edit? I've never had any errors running the scripts for MySQL so it makes me think you are using a very old version of MySQL.

Also please note whether you are using the release files or working with the source code

Hope it helps,

Joe
6/9/2005 8:12:16 PM
Gravatar
Total Posts 2

Re: problems with the database connection

Hi Joe, sorry to have bothered you, I took a look once again at my connection string, the data source was set to "Suse", upon editiong the data source(localhost), mojo portal started up, it works very well now, keep up the good work :-)

Oh, for the record, I dont know if my method has been tried before, I´m running MojoPortal on the free Cassini web server with .net 1.1.


Thanks
6/10/2005 2:22:03 AM
Gravatar
Total Posts 18439

Re: problems with the database connection

Cool, I've never tried Cassini, good to know that works!
9/17/2005 1:42:26 AM
Gravatar
Total Posts 3

Re: problems with the database connection

Hi there Joe,


First and foremost, congrats on a great-looking portal. I'm really looking forward to being able to
use it!!!

I've got a similar problem going on my server, looked into the above but to no avail...?

I've successfully created the database, granted the mojo user the permission to access the
localhost (a mysql -u mojo -p mojoportal brings me in just fine without being root),

I've made the mods to my Web.config file (I even changed the values for all three connection strings?
just in case... :P).?

An nslookup resolves just fine to the usual 127.0.0.1, and a rename to web.config seems to confuse
the app (I get a null ref exception...? If I have both Web.config and web.config in the folder,
the connection error occurs rather than the null ref)
I've kind of run out of ideas, any suggestions?
FYI: Mandriva Linux 2005, mono 1.1.9 installed via the installer, MySQL, attempting to run
mojoportal via XSP, no extra changes made to the Web.config file.?
When attempting to run mojoportal, running XSP as root.
My database changes (used loopback address but also localhost):

Thanks in advance and best regards,

Rick
9/17/2005 3:28:09 AM
Gravatar
Total Posts 18439

Re: problems with the database connection

Hi Rick,

What version of MySQL are you using? If you are using 4.1.14 that will be a problem because it requires the very newest MySQL Connector. mojoportal ships with the previous release of the Connector and I can't upgrade it yet because the new connector doesn't work under mono, only under Windows. The author of the connector, Reggie Burnett, has said they will have it working on mono again for the next release. So if you have 4.1.14 I recommend uninstall it and go back a version of MySQL so it can work with the current connector that does work under mono.

If you have some other version please post the stack trace of the error

Thanks,

Joe
9/17/2005 4:44:08 AM
Gravatar
Total Posts 3

Re: problems with the database connection

Thanks for the quick reply!? I've actually got a slightly older version,? 4.1.11... Tried to check what the latest version supported by the connector is, without success...? Do you know if this version works?

Here's the stack trace:

Server error in '/' application
Description: Error processing request.

Error Message: HTTP 500.

Stack Trace:

MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts
in <0x006c5> MySql.Data.MySqlClient.NativeDriver:Open ()
in <0x00027> MySql.Data.MySqlClient.Driver:Create (MySql.Data.MySqlClient.MySqlConnectionString settings)
in <0x0008d> MySql.Data.MySqlClient.MySqlPool:CreateNewPooledConnection ()
in <0x001b0> MySql.Data.MySqlClient.MySqlPool:GetPooledConnection ()
in <0x0003f> MySql.Data.MySqlClient.MySqlPool:GetConnection ()
in <0x000e5> MySql.Data.MySqlClient.MySqlPoolManager:GetConnection (MySql.Data.MySqlClient.MySqlConnectionString settings)
in <0x00050> MySql.Data.MySqlClient.MySqlConnection:Open ()

Thanks again in advance,
Rick.
9/17/2005 4:55:35 AM
Gravatar
Total Posts 18439

Re: problems with the database connection

The most likely cause of this is that MySQL is not configured to accept tcp/ip connections.
See here http://dev.mysql.com/doc/mysql/en/can-not-connect-to-server.html
make sure your /etc/mysql/my.conf file does not have the "skip-networking" feature enabled. This is the default in some installations and disables tcp/ip connections.

Hope it helps,

Joe
9/17/2005 5:20:52 AM
Gravatar
Total Posts 3

Re: problems with the database connection

Yup, that did the trick!

Thank you very much Joe, and sorry for the trouble...

All the best,
Rick.
You must sign in to post in the forums. This thread is closed to new posts.