LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-08-2010, 12:09 AM   #1
rufat
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Rep: Reputation: 0
Problem with connect to Remote Sql Server 2000 from centos 4.5 with PHP


Hi to all.
I have problem with connection to mssql 2000 from centos. i have installed php, freetds, unixOBDC on server Centos. My mssql server on another computer (windows xp). Now, when i tried to connect mssql with php :

>> mssql_connect("192.168.179.100","sa","sa")

Centos return to me "Unable to connect to server: 192.168.179.100 in /var/www/html/work/test.php on line 15 "

can anyona help me, please..

note: mssql is running on windows, and user and password is same "sa".
 
Old 02-08-2010, 12:22 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
First just try to connect using the command line client not php. On your centos machine do
Code:
mysql --host=192.168.179.100 --user=sa --passord=sa
If this also fails then you will know that it is an issue with the server configuration: best look in the documentation for mssql for you xp box.

If it works, we can start to try to isolate the problem within the php.

Evo2.
 
Old 02-08-2010, 12:33 AM   #3
rufat
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by evo2 View Post
First just try to connect using the command line client not php. On your centos machine do
Code:
mysql --host=192.168.179.100 --user=sa --passord=sa
If this also fails then you will know that it is an issue with the server configuration: best look in the documentation for mssql for you xp box.

If it works, we can start to try to isolate the problem within the php.

Evo2.

my database is MSSQL. i try command like that:
>> tsql -H "192.168.179.100" -p1433 -U sa -P sa

but now except this message :

Msg 10018, Level 9, State 0, Server OpenClient, Line 0
The connection was closed
Msg 20014, Level 9, State 0, Server OpenClient, Line 0
Login incorrect.
There was a problem connecting to the server
You have new mail in /var/spool/mail/root
 
Old 02-08-2010, 12:39 AM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Ok, time to start looking at the logs on the database server.

Cheers,

Evo2.
 
Old 02-08-2010, 12:55 AM   #5
rufat
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by evo2 View Post
Ok, time to start looking at the logs on the database server.

Cheers,

Evo2.
thank you Evo but i cant i dont think that problem is my Database server. because from another windows OS have connection database server and all normal. Only from linux i cant connect.
 
Old 02-08-2010, 12:59 AM   #6
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Quote:
Originally Posted by rufat View Post
thank you Evo but i cant i dont think that problem is my Database server. because from another windows OS have connection database server and all normal. Only from linux i cant connect.
Ok, but the server logs should give more useful information about why the login was not accepted. Another thing to check is if the command line client has a verbose option: for example with mysql that would be the --verbose or -v flag.

Evo2.
 
Old 02-08-2010, 02:23 AM   #7
rufat
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by evo2 View Post
Ok, but the server logs should give more useful information about why the login was not accepted. Another thing to check is if the command line client has a verbose option: for example with mysql that would be the --verbose or -v flag.

Evo2.
when i try to connect database server , there is no any changes in log file database server. i copied my log file text, cant see any important information about this :

2010-02-08 11:25:29.45 server Microsoft SQL Server 2000 - 8.00.194 (Intel X86)
Aug 6 2000 00:57:48
Copyright (c) 1988-2000 Microsoft Corporation
Personal Edition on Windows NT 5.1 (Build 2600: Service Pack 2)

2010-02-08 11:25:29.45 server Copyright (C) 1988-2000 Microsoft Corporation.
2010-02-08 11:25:29.45 server All rights reserved.
2010-02-08 11:25:29.45 server Server Process ID is 2948.
2010-02-08 11:25:29.45 server Logging SQL Server messages in file 'C:\Program Files\Microsoft SQL Server\MSSQL\log\ERRORLOG'.
2010-02-08 11:25:29.45 server SQL Server is starting at priority class 'normal'(4 CPUs detected).
2010-02-08 11:25:30.10 server SQL Server configured for thread mode processing.
2010-02-08 11:25:30.10 server Using dynamic lock allocation. [500] Lock Blocks, [1000] Lock Owner Blocks.
2010-02-08 11:25:30.14 spid4 Starting up database 'master'.
2010-02-08 11:25:30.29 server Using 'SSNETLIB.DLL' version '8.0.194'.
2010-02-08 11:25:30.29 spid5 Starting up database 'model'.
2010-02-08 11:25:30.31 server SQL server listening on Shared Memory, Named Pipes.
2010-02-08 11:25:30.31 server SQL Server is ready for client connections
2010-02-08 11:25:30.32 spid4 Server name is 'RUFAT-PC'.
2010-02-08 11:25:30.32 spid4 Skipping startup of clean database id 4
2010-02-08 11:25:30.32 spid4 Skipping startup of clean database id 5
2010-02-08 11:25:30.32 spid4 Skipping startup of clean database id 6
2010-02-08 11:25:30.32 spid4 Skipping startup of clean database id 7
2010-02-08 11:25:30.39 spid5 Clearing tempdb database.
2010-02-08 11:25:30.82 spid5 Starting up database 'tempdb'.
2010-02-08 11:25:30.92 spid4 Recovery complete.


have you another idea ?
 
Old 02-08-2010, 02:39 AM   #8
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Quote:
Originally Posted by rufat View Post
when i try to connect database server , there is no any changes in log file database server. i copied my log file text, cant see any important information about this :
<snip>
have you another idea ?
Ok, you can try to ping the sever and also try to port scan it to see if the connection is being made. On the centos box:

Code:
ping 192.168.179.100
nmap 192.168.179.100
You should at least be able to see port 1433 open.

Evo2.
 
Old 02-08-2010, 02:50 AM   #9
rufat
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by evo2 View Post
Ok, you can try to ping the sever and also try to port scan it to see if the connection is being made. On the centos box:

Code:
ping 192.168.179.100
nmap 192.168.179.100
You should at least be able to see port 1433 open.

Evo2.
ok, i done. ping goes normally. but after this command , shown result :

Starting Nmap 4.76 ( http://nmap.org ) at 2010-02-08 12:47 AZT
Interesting ports on trixbox1.localdomain (192.168.179.100):
Not shown: 994 closed ports
PORT STATE SERVICE
80/tcp open http
135/tcp open msrpc
139/tcp open netbios-ssn
445/tcp open microsoft-ds
912/tcp open unknown
3389/tcp open ms-term-serv
MAC Address: 00:1F:29A:A3:74 (Hewlett Packard)


so, port 1433 is not shown this list. whats it mean? port is closed on database server or linux cant see it?
 
Old 02-08-2010, 03:00 AM   #10
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Quote:
Originally Posted by rufat View Post
so, port 1433 is not shown this list. whats it mean? port is closed on database server or linux cant see it?
Looks like it is closed.
If it's open, nmap should have seen it. Perhaps it is being blocked by a firewall. Is your centos client box on a different subnet to the boxes which can connect?

Evo2.
 
Old 02-08-2010, 04:34 AM   #11
rufat
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by evo2 View Post
Looks like it is closed.
If it's open, nmap should have seen it. Perhaps it is being blocked by a firewall. Is your centos client box on a different subnet to the boxes which can connect?

Evo2.
hmm, so, i must open 1433 port on my database server. i think that this port must be opened on mssql server starting. can you say, if my 1433 port is closed, can another client connect to this server? i cant understand your question. My centos client connected to internet.
 
Old 02-08-2010, 04:40 AM   #12
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
You said in post #5 that some windows clients can connect to the server ok, but your centos client can not. Ie the windows clients must see port 1433 as open, but the centos client sees it as closed. So, I was wondering what is different (if anything) about the network(s) that the windows clients are on compared to the centos client. Is the sql server behind a firewall that only opens 1433 for certain client IPs or networks?

Evo2.
 
Old 02-08-2010, 06:54 AM   #13
rufat
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by evo2 View Post
You said in post #5 that some windows clients can connect to the server ok, but your centos client can not. Ie the windows clients must see port 1433 as open, but the centos client sees it as closed. So, I was wondering what is different (if anything) about the network(s) that the windows clients are on compared to the centos client. Is the sql server behind a firewall that only opens 1433 for certain client IPs or networks?

Evo2.
i type command in command line : -anop TCP // and result is like this(port 1433 is not shown)

Active Connections

Proto Local Address Foreign Address State PID
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 232
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 1560
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4
TCP 0.0.0.0:912 0.0.0.0:0 LISTENING 1892
TCP 0.0.0.0:2508 0.0.0.0:0 LISTENING 376
TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING 1512
TCP 127.0.0.1:1664 0.0.0.0:0 LISTENING 3748
TCP 192.168.179.100:139 0.0.0.0:0 LISTENING 4
TCP 192.168.179.100:139 192.168.179.100:3366 TIME_WAIT 0
TCP 192.168.179.100:139 192.168.179.100:3371 TIME_WAIT 0
TCP 192.168.179.100:139 192.168.179.100:3378 TIME_WAIT 0
TCP 192.168.179.100:139 192.168.179.100:3388 TIME_WAIT 0
TCP 192.168.179.100:139 192.168.179.100:3394 TIME_WAIT 0
TCP 192.168.179.100:139 192.168.179.100:3399 TIME_WAIT 0
TCP 192.168.179.100:139 192.168.179.100:3406 TIME_WAIT 0
TCP 192.168.179.100:139 192.168.179.100:3411 TIME_WAIT 0
TCP 192.168.179.100:139 192.168.179.100:3419 TIME_WAIT 0
TCP 192.168.179.100:445 192.168.77.114:4570 ESTABLISHED 4
TCP 192.168.179.100:445 192.168.77.114:4576 ESTABLISHED 4
TCP 192.168.179.100:445 192.168.179.84:3946 ESTABLISHED 4
TCP 192.168.179.100:1051 94.100.181.58:2041 ESTABLISHED 3620
TCP 192.168.179.100:1270 192.168.179.104:22 ESTABLISHED 3132
TCP 192.168.179.100:1489 192.168.179.104:22 ESTABLISHED 3924
TCP 192.168.179.100:1490 192.168.179.104:22 ESTABLISHED 3732
TCP 192.168.179.100:2730 209.85.137.125:5222 ESTABLISHED 1456
TCP 192.168.179.100:2981 64.12.25.191:443 ESTABLISHED 1456
TCP 192.168.179.100:3004 64.12.165.95:443 ESTABLISHED 1456
TCP 192.168.179.100:3007 64.12.26.225:443 ESTABLISHED 1456
TCP 192.168.179.100:3365 192.168.179.100:445 TIME_WAIT 0
TCP 192.168.179.100:3366 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3367 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3370 192.168.179.100:445 TIME_WAIT 0
TCP 192.168.179.100:3371 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3372 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3377 192.168.179.100:445 TIME_WAIT 0
TCP 192.168.179.100:3378 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3379 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3382 192.168.179.100:445 TIME_WAIT 0
TCP 192.168.179.100:3387 192.168.179.100:445 TIME_WAIT 0
TCP 192.168.179.100:3388 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3390 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3393 192.168.179.100:445 TIME_WAIT 0
TCP 192.168.179.100:3394 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3395 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3398 192.168.179.100:445 TIME_WAIT 0
TCP 192.168.179.100:3399 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3400 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3405 192.168.179.100:445 TIME_WAIT 0
TCP 192.168.179.100:3406 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3407 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3410 192.168.179.100:445 TIME_WAIT 0
TCP 192.168.179.100:3411 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3412 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:3418 192.168.179.100:445 TIME_WAIT 0
TCP 192.168.179.100:3419 192.168.179.100:139 TIME_WAIT 0
TCP 192.168.179.100:4678 192.168.179.104:22 ESTABLISHED 2812
TCP 192.168.179.100:4932 192.168.179.84:80 CLOSE_WAIT 748

my Centos's ip is : 192.168.179.104.

hmm, i dont now how to connect another client to my database server ,by which port . thank you for helps.

Last edited by rufat; 02-08-2010 at 07:15 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with FreeTDS, connecting to MS SQL Server 2000 domiflichi Linux - Software 2 06-23-2009 09:14 AM
Mount doesn't connect to remote server CentOS 5.2 FogOgg Linux - Networking 0 03-21-2009 04:39 PM
SQL Server 2000 assatron Linux - Software 4 08-19-2004 03:02 PM
Connecting to Microsoft SQL Server 2000 sput Linux - Distributions 7 08-25-2003 09:06 PM
PHP and MS SQL Server 2000 balfred Programming 0 03-24-2003 03:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration