|
I have a database application I was designing that I haven't worked on in a while. Recently I started it up to start working on it again and I was getting a connection error when trying to connect to the database. The error message is:
"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"
and the connection string is "Server=localhost;Database=medicehr_provider;Uid=root;Pwd=********;"
However if I replace 'localhost' with '127.0.0.1' then my application can connect to the MySql server. I can't figure out why all of a sudden it needs the actual IP address. I checked the hosts file in C:\Windows\System32\Drivers\etc and it does contain an entry for localhost.
Any ideas or suggestions why 'localhost' isn't being recognized and '127.0.0.1' is would be greatly appreciated.
|
|
|
|
|
Can you ping localhost? If yes, then it's probably the driver - did you recently update it?
DisIsHoody wrote: it does contain an entry for localhost. In which form?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: Can you ping localhost?
That isn't really going to tell you anything. If it succeeds it tells you nothing about the database. If it fails, if that is even possible, it just means localhost is redirected. But still says nothing about the database.
|
|
|
|
|
jschell wrote: That isn't really going to tell you anything. It's going to tell me whether the DNS and the host-file know what IP I'm talking about.
jschell wrote: But still says nothing about the database. I'm interested in reaching the PC before I reach for a specific database on that PC.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: It's going to tell me whether the DNS and the host-file know what IP I'm talking about.
You do know that the OP is asking about "localhost" correct?
|
|
|
|
|
Yes
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
DisIsHoody wrote: Any ideas or suggestions why 'localhost' isn't being recognized
1. You have set something up somewhere that resolves 'localhost' to something besides your local host.
2. The database server has been configured to host itself specifically on your IP and is not hosted on 'all' IPs on the box.
You can determine the first by using nslookup or whatever the equivalent is for your OS.
|
|
|
|
|
Add
127.0.0.1 localhost
in your C:\Windows\System32\drivers\etc\hosts file
|
|
|
|
|
@Eddy: From the command prompt I typed "ping localhost" and the response was "Reply from ::1: time=1ms" so it is recognizing localhost, although I expected it to say "127.0.0.1" instead of "::1: which if I'm not mistaken is IPv6. Could this be the source of the issue?
@jschell: In response to item 2, how can I check this? I'm using MySQL Community Edition and I do all my set up/maintenance through MySQL WorkBench. Can you provide some guidance on this?
@SarveshShukla: In my original post I mentioned I already checked this and there was already an entry for 127.0.01 to localhost.
Thank you so far for all the help and suggestions. It is greatly appreciated.
P.S. I forgot to mention that although I'm using MySQL Workbench and all my database design was originally pure MySQL I did change it to MariaDB and also use HeidiSQL for when I design my tables and whatnot. I checked and MySQL Workbench still connects to the tables and I can modify/create/update table schemas and data in either HeidiSQL or MySQL Workbench and the other program will see the appropriate changes. But as far as the actually database server settings I still use MySQL Workbench.
|
|
|
|
|
This is not facebook or twitter.
Please reply to each message by clicking the "Reply" link end of each message(Like I replied you).
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|
|
DisIsHoody wrote: Could this be the source of the issue? Yes. Replace it with 127.0.0.1, and try again.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
DisIsHoody wrote: @jschell: In response to item 2, how can I check this?
Myself I use telnet (client). If you do not have this installed already then it already in the OS (windows) just go the "control panel" -> "Programs and Features" -> "Turn Windows features on or off" and then look for "Telnet Client".
You run telnet with the following command in a console window.
telnet <host> <port>
All you care about is whether it connects or not. If it connects you get a blank screen. If it fails, which can take some time (or not) you get an error.
You can find the regular ip of your computer by running the following command (windows) in a console window.
ipconfig
Both of the databases you cited use port 3306 by default.
So using the above the following three commands should tell you what is going on.
telnet local host 3306
telnet 127.0.0.1 host 3306
telnet <box ip address> host 3306
If all three fail then it means you are using a different port.
If just the localhost one fails then it means you have redirected local host.
If just the first two fail then it means that you have set your database up to bind to your regular ip and not 127.0.0.1.
The above of course makes the assumption that your really are running the database on your local box (and that your test with the GUI tool was valid and was actually connecting to the database on your box and not some database on another box.)
|
|
|
|
|
Hi I want to learn the basics of database. What is it?How we establish it.How can I attach it to my website.Please provide me some good tutorials for learning it. Thanks in advance.
|
|
|
|
|
There are multiple questions here and a variety of answers. To start with, there different types of databases by multiple companies. I would start out with MySql or MariaDB as both of these are available without paying a licensing fee.
Once you have determined what type of database you want to use then you have to determine what web technology you want to learn/use; ASP.NET, PHP, Java, etc.
Your question(s) are a too general to give you a specific answer. Google is your friend in this case. I would start by going to MySQL 5.6 Reference Manual. From this page you can learn everything about MySQL; tutorials, installation, administration. Download the software, read through the manual, and then if you have any specific questions I'm sure people here will help you as much as they can.
|
|
|
|
|
|
I have a table that it has a field with nvarchar datataype.
the content of this field Containing different of information such as phone number,address and ...
how do I grouping it In various fields?
|
|
|
|
|
Not enough information. Please provide more details as follows:
How many different information is contained in the field? Is the number of different information fixed? Is the sequence of different information fixed? How are they being separated (by comma or single space)?
|
|
|
|
|
some record containing 2 or 3 phone number that separate with space or 2dash or 3dash or ...
some record containing a sequenece of string or some record containing both of them.
|
|
|
|
|
Your table is in a mess, there is no fixed structure at all. The only way out is to do a manual clean up, and before that do remember to backup a copy of the original table. You must at least put in place some structure, say 'name', 'address', 'phone' that is comma separated and in fixed order and fixed number. Only then, you can use my solution to split and insert them into a new table. Work hard.
|
|
|
|
|
Peter, can you do us a favour and not edit spam questions in QA?
The instructions from Chris are to not edit the spam messages, just report them as spam and let the community (or a protector) delete them. The reasoning seems to be that from time to time he tries new spam filters and if you edit the message, then they "learn" what is and isn't spam from the edited message, which is no use!
Leaving them untouched, but hitting the "spam" button sends the unedited content to the filter, and it shoudl learn to distinguish real spam better.
Thanks!
Never underestimate the power of stupid things in large numbers
--- Serious Sam
|
|
|
|
|
|
No need to apologize - you weren't to know!
Never underestimate the power of stupid things in large numbers
--- Serious Sam
|
|
|
|
|
can I use length of field?because the length of fields containing a sequence string is very more than phone number,and fields their length is less than phone number is other type information.
I think with this way,problem solve
but I don't know code.
|
|
|
|
|
|