I'm having a strange issue on a couple of client sites with Firebird and .net. I am using firebird 2.1 and the DDEX Provider for visual studio, and I'm working in c#. Specificaly I'm getting a very general exceptions as follows:
Exception on trying to connect to firebird DB:
FirebirdSql.Data.FirebirdClient.FbException: Unable to complete network request to host "10.206.34.177".
---> FirebirdSql.Data.Common.IscException: Exception of type 'FirebirdSql.Data.Common.IscException' was thrown.
at FirebirdSql.Data.Client.Gds.GdsConnection.Connect(String dataSource, Int32 port, Int32 packetSize, Charset charset)
at FirebirdSql.Data.Client.Gds.GdsDatabase.Attach(DatabaseParameterBuffer dpb, String dataSource, Int32 port, String database)
at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect()
--- End of inner exception stack trace ---
at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect()
at FirebirdSql.Data.FirebirdClient.FbConnectionPool.Create()
at FirebirdSql.Data.FirebirdClient.FbConnectionPool.CheckOut()
at FirebirdSql.Data.FirebirdClient.FbConnection.Open()
at Seljax.Database.Firebird.DatabaseManager.TryToConnect()
This would seem to me to indicate an issue with the network, perhaps a fire wall or somthing of that sort in place? And yet I can't seem to find the block?
More information (2 distinct cases):
Case 1 (network 1):
Windows 7 x64 computer, running service pack 1. I have configured firebird to use a port of 5013, and it connects just fine with if I specify the local loopback address (127.0.0.1). Further it connects just fine the the local IP Adress (10.206.34.177) which is currently configured as satic with a netmask of 255.255.255.192. However, if I change this computer to use a dynamic IP a开发者_如何学Cddress (fetched from the DHCP server), and try to connect to the IP (in this case I was getting 10.206.34.184 mask 255.255.255.192) I get the exception above. As best I can tell, I've configured everything the same as what the DHCP server provides, except using a static IP. Further to all of this, I've tried the following to make it work with the Dynamic IP Address: - turned off the windows firewall - turned off microsoft secuirty essencials (realtime protection) - turned off both firewall and MSE - ensured the the user account controls are set to minimum - Disabled IPV6 from the network configuration
As best as I can tell, the network is setup to not filter any sort of internal network traffic. I can ping the local system just fine. I have a simple program that opens a socket to the system using c#'s TcpClient class and it connects just fine to the ip and port, which I think means that a socket connection is established, which would "seem" to indicate that it would work.
Note, I've looked as best I can I wasn't able to find any other antivirus or firewalls installed outside of microsoft security essensial, and the built in firewall.
Totaly at a loss, suggestions please?
Case 2 (network 2):
Windows 7 x32 computer, No SP1. I've left the firebird port configured to 3050. this machine I can't even connect to using the loopback address (127.0.0.1). I've tried static, non-static, disabling IPV6, disabling firewall, and disabling MSE. IP for this machine: 10.200.81.179 mask 255.255.255.192.
Update - this machine can now connect to itself, after changing all three machiens on the network to use static IP Addresses, but a new problem presented, listed below
Again, totaly at a loss for ideas, suggestions please?
Even more infomration: I've setup a crazy simple test program that has 3 text boxes that I can populate to connect to the database with, and I've confimed it does work as expected with firebird running, and with is not running it generates the exact same errors I get on the clinet machines.
So for example you start the firebird service, run the connect, success, shut down the service, run the connect, and the exception above, and all the other exceptions from the FbException will match that of the machines I'm trying to connect to.
I have all the code setup on a button click, anyway, for reference the code that will cause the exception is here:
// setup connection
FbConnectionStringBuilder csb = new FbConnectionStringBuilder();
csb.DataSource = firebirdAddress.Text;
csb.Port = Convert.ToInt32(firebirdPort.Text);
csb.Database = firebirdPath.Text;
csb.ServerType = 0;
csb.UserID = "SYSDBA";
csb.Password = "masterkey";
csb.Dialect = 3;
// generate the conneciton object
string connectionString = csb.ToString();
FbConnection connection = new FbConnection(connectionString);
try
{
MessageBox.Show("Trying to connect with string: " + Environment.NewLine + connectionString);
connection.Open();
MessageBox.Show("Firebird connected successfully!");
}
catch ( Exception exception)
{
FbException fireException = (FbException) exception;
for ( int i = 0; i < fireException.Errors.Count; i++ )
{
MessageBox.Show("Class: " + fireException.Errors[i].Class.ToString() + Environment.NewLine +
"Error #" + fireException.Errors[i].Number.ToString() + ": " + fireException.Errors[i].Message + " on line " +
fireException.Errors[i].LineNumber.ToString() );
}
MessageBox.Show("Exception caught: " + Environment.NewLine + exception.ToString());
// loop through all inner exceptions
while ( exception.InnerException != null )
{
MessageBox.Show("Inner exception: " + Environment.NewLine + exception.InnerException.ToString());
exception = exception.InnerException;
}
}
finally
{
connection.Close();
connection = null;
connectionString = null;
csb = null;
}
Anyway, any suggestions or information would be very appricated!
Some more information has come to light, in case 1 above I am successfully able to connect to the computer using a windows XP machine and the code displayed above for getting connected.
Is windows doing something strange with the ip routing??
Update: The computer in case 2 not being able to connect to the 127 address has been "fixed" by changing all the machine on the network to use a static IP address. however case 2 has become more interesting. There are three computers in the senario. The three can "sortof" comunicate now as they are all set to static IPs.
Details of communication:
Computer A Computer B Computer C
works works doesn't work Computer A
works works doesn't work Computer B
doesn't work works works Computer C
The obvious answer would be to put the server on computer B and go with it, but it doens't work logisticaly, as that computer is a very poor machine, and is rarely on. Note, all three are running windows 7
Resolution: The case 2 above where some computers couldn't talk to others and there were 3 machines involved, turned out to be that there were 2 computer with the same name on the network. My best guess is that windows, or firebird, or both somehow depend on the name for communictaion, and the duplicate name was blocking it.
In case 1 the resolution we went with is simply to keep the machine as a static IP address. Not sure why this is nessicary, but it does fix the problem. further there is a second machine on this network that is also windows 7 and would not connect correctly without having a static IP Address.
As the info posted in your comments, I think your problem may be one of these:
- Local windows Firewall or other firewall software (AntiVirus, for example) is blocking the connection. You usually have to manually add a rule or exception to allow incomming traffic to the port in which Firebird is listening.
- Firebird is not listening on that particular interface (not likely if you didn't change the configuration), check the
RemoteBindAddress
of your firebird.conf file
#
# Allows incoming connections to be bound to the IP address of a
# specific network card. It enables rejection of incoming connections
# through any other network interface except this one. By default,
# connections from any available network interface are allowed.
# If you are using Classic Server, this setting is for Windows only.
# Under Linux, BSD or Mac OS X, with Classic server use xinetd or launchd
# configuration file (bind parameter)
#
# Type: string
#
RemoteBindAddress = 127.0.0.1
You can check if Firebird is listening at the port with the netstat -a
command.
This output means Firebird is listening on all interfaces:
TCP 0.0.0.0:3050 jacastillo:0 LISTENING
while this is when it's listening a specifically in 127.0.0.1
TCP 127.0.0.1:3050 jacastillo:0 LISTENING
3050 is the default port, check for the right port you're listening on
Okay, so in Case 2, the problem turned out to be there were two computers on the network with the same name!!!
I'm a bit beside myself right now with the simplicity of the problem and the weird symptoms this was generating.
I'm not sure how or why this was the case, but it's fixed now. I will be checking on Case 1 tommorrow.
For refrence case 1 and case 2 where, on two seperate networks.
精彩评论