473,405 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

ODBC, Linux, Win2k - how to automate DSN setup?

I need to access databases on both win2k and Linux systems but I have to set
up the DSNs under program control ... no uses using GUIs ...

Has anyone done this? if so can we discuss it either in here or offline?

thanks

Tom

Jul 17 '05 #1
1 4963
"Tom Jones" <to******@lucent.com> wrote:
I need to access databases on both win2k and Linux systems but I have to set
up the DSNs under program control ... no uses using GUIs ...

Has anyone done this? if so can we discuss it either in here or offline?

thanks

Tom


I have not been successful with the ODBC route on Linux. As far as
unixODBC is concerned -- it's a joke to me because I see no way to
configure or use it.

Try FreeTDS from freetds.org, which then integrates with PHP's mssql_*
API library. TDS is the native protocol of SQL Server 6.5, 7, and 2K.

side note {
BTW, have another database out there on the Windows platform that you
want to connect to? You can use the SQL Server 7 or 2K's Linked
Servers technique (see a howto by doing a search on Google) in SQL
Server to link it to MS Access, MS Excel, or almost any database you
want on the Windows side. Linked Servers is under the "Security"
folder in SQL 7 or 2K. Once linked, you use a special syntax that
looks like this:

select * from <server>.<database>.dbo.<table> --> for a SQL server
connection
or
select * from <app name>...<table> --> for something like an MS Access
connection
}

Anyway, back on FreeTDS...

1. Prove to yourself that your Linux firewall config is setup right by
pinging the other MS SQL Servers and see if you get a response, then
trying to telnet to port 1433 on that remote SQL Server. If you can
even get in, but cannot type anything without a decent response, then
your firewall is setup to give you access.

2. Now use FreeTDS's tsql test tool to test it by doing:

tsql -S ip.ip.ip.ip -H windows01 -p 1433 -U sa -P ''

Of course, replace ip.ip.ip.ip, windows01, sa, and '' with what is
appropriate for your environment.

Once in, you'll see:

1>

Type:

use pubs
go
select * from authors
go
\q

This proves that FreeTDS works.

3. You'll need to find out how to recompile PHP and Apache with mssql
support via FreeTDS. This is no cakewalk and I've had some failed
attempts. One of the big problems is that the process for compilation
to get FreeTDS support is a changing thing -- sites on the web, and
even on the PHP.net website, give conflicting or erroneous
information. Still, however, I persist, because I think eventually I
will get it right. Jochen Daum out of New Zealand has been giving me
advice in this newsgroup for the past couple of days, but I have yet
to get it right on my system. On Monday and Tuesday (11/24-25/2003)
I'm going to be trying feverishly hard to give it a good stabbing
again.

4. Although it is not recommended, if I cannot get freeTDS support in
PHP, I just might use PHP shell commands to execute tsql, get a
result, parse it, and use it. The tsql app recommends you don't do it,
but if it works, and I need a quick interim measure, I might have no
choice.

5. Another route I've considered, which would be a big project, is to
bring up a socket server on Windows using Visual Basic 6 and the
Winsock control. Many books and websites describe how to properly
build a socket server by using a "control array" in VB6. Anyway, the
socket server will sit on a TCP port. I would have to use my own
protocol so that the Linux system could login, make a SQL request,
receive a response, and parse it. PHP has a socket API that I could
use for calling the Windows system. On the Windows system, I could use
the ADO library in COM to access the SQL Server, Access, or other
database, get a response, and send it back. A big problem, however,
might be lockups, so I expect that I'll need to build something that
runs from Windows Scheduled Tasks to kill the VB app if the last
request it made was longer than 15 minutes ago. As for the protocol,
one could use a very simple XML, or could come up with something
simpler and with less parsing (and processor time) required. I've
thought the protocol could be unencrypted, but that I would require a
password on each SQL request, and a proprietary CRC set of bytes would
need to be included with every TCP stream in order to ensure that
hackers couldn't get in very easily. I might also restrict which host
IP could get into that socket server as a means to block hackers too.

Anyway, here's the calamity I'm in, and why I'm desperate to connect
PHP/Linux to MS SQL Server. I was working a lot in Linux/JSP, which
has more than one MS SQL Server JDBC driver. I sold my boss on going
with Linux/JSP rather than MS/ASP or MS/.NET. Then, I discovered PHP,
and had a lot of success with it and could knock out more work than
JSP, so I convinced the boss that this was the way to go. When I did
that, however, I never realized that MS SQL Server access would be so
dang aggravatingly difficult from PHP, requiring PHP and Apache
recompilation on RH9. So now I have very little time to prove to my
boss that PHP is great, and can suit our needs in the office, before
he pulls the plug on me and says we're going to go Linux/JSP, which I
find more time-consuming.
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sean Anderson | last post by:
ODBC under System DSN Setup Access Driver give it the DSN (Data Source Name) MSA Click on Select and point to the myfile.mdb (your database file)
10
by: David ROBERT | last post by:
Hello, I need to read data from a MS Access database. The program (reader) is installed on a linux box and is written in python langage. The database is MS Access 2002 installed on a Win XP box...
13
by: Peter Maas | last post by:
Recently I replaced Win2k with Linux on my desktop computer. Using mostly multi-platform software I thought this would be easy. It was not as easy as expected getting wxPython to work. There seemed...
0
by: Chetan | last post by:
I have setup an ODBC driver for my MySQL database and use a 3rd party program to connect to it. Everytime the software connects, the ODBC driver setup screen pops up. I have to click OK on it to...
2
by: bbxrider | last post by:
win2k adv server/ iis5.0/vb6.0/ado and/or odbc connections on client machine i have an mdb on win2k adv server machine and want internet read/write to it from both a non-windows, red hat, webserver...
2
by: Marco Martin | last post by:
Hi, I posted earlier about beeing able to find an SQL server database through code and someone was kind enough to help me out(thank you Scott). I now have another question; My app was...
0
by: 이재국 | last post by:
Please help point me in the right direction. I am trying to SQLDriverConnect to our Oracle Server, which resides on another machine in the network. I believe I have the ODBC connection set up...
3
by: Richard Morton | last post by:
Hi, This is my first posting to this list, I guess a small intro should be first, been developing in PHP for sometime, mainly with Mysql and nearly always on Windows (oops, sorry). I have...
2
by: Philippe Martin | last post by:
Hi, I understand that access can be accessed through an ODBC driver under windows (instead of Jet). I am wondering if the same can be done under Linux. Regards, Philippe
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.