473,396 Members | 2,013 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,396 software developers and data experts.

TCP/IP access

I'm looking for information on how to log on and access a databases using
TCP/IP. I don't want to use MyODBC or J or .NET or anything else, I don't
want to telnet and use a shell... I just want to send stuff over a port and
get an answer back.

As far as I understand it, I'm going to have to dissect libmysql.c. Ok, but
hasn't somebody already done this? And anyway, where the heck is it? None of
the archives I can find have any source code in 'em.
--
-SHAWN-
Jul 23 '05 #1
10 2249
Shawn Fessenden wrote:
I'm looking for information on how to log on and access a databases using
TCP/IP.


You can do that with mysql command line client. If you want to connect
to remote computer:

mysql -h remote.address.example -u username -p
Jul 23 '05 #2
> You can do that with mysql command line client.

Thanks for your reply, but that's exactly the kind of thing I want to avoid.
I just want to use raw TCP/IP.
--
-SHAWN-
Jul 23 '05 #3
Shawn Fessenden wrote:
I'm looking for information on how to log on and access a databases using
TCP/IP. I don't want to use MyODBC or J or .NET or anything else, I don't
want to telnet and use a shell... I just want to send stuff over a port and
get an answer back.

As far as I understand it, I'm going to have to dissect libmysql.c. Ok, but
hasn't somebody already done this? And anyway, where the heck is it? None of
the archives I can find have any source code in 'em.


What you want to do is not a good thing.

TCP/IP is a communications protocol -- not a shell or a database
application. Think of it as a ship carrying containers with no
ability to open the container. As a result what you want to do
isn't supported and isn't likely to be supported.

Of course if you "own" the server and clients that will use your
database and both run on an open source operating system you can
modify the TCP/IP code for your server and your clients so that
TCP/IP can recognize and properly handle database requests.

This is a bad idea. For one thing, you will need unique code
for every operating system used by either your server or your
clients. Any time the operating system of either is upgraded
you will have to test and validate your TCP/IP code and possibly
modify it.

For another, running your own version of TCP/IP may preclude
your clients being able to communicate with other servers and
perhaps even preclude your server talking to other clients.

HTH

Jerry
Jul 23 '05 #4
Shawn Fessenden wrote:
I'm looking for information on how to log on and access a databases using
TCP/IP. I don't want to use MyODBC or J or .NET or anything else, I don't
want to telnet and use a shell... I just want to send stuff over a port and
get an answer back.

As far as I understand it, I'm going to have to dissect libmysql.c. Ok, but
hasn't somebody already done this? And anyway, where the heck is it? None of
the archives I can find have any source code in 'em.


Yes, somebody has done this already, written a portable C API for it,
and documented it pretty thoroughly.

http://dev.mysql.com/doc/mysql/en/c.html

I strongly recommend against you duplicating this effort by writing your
own client interface directly at the TCP/IP level. By doing this, you'd
create a huge amount of work to maintain your interface in sync with
MySQL's client/server protocol. For instance, if they change any
implementation within their protocol internally without changing their
client API, there's no reason for them to notify you, so you'd have to
constantly monitor code changes to the client and server source code of
the MySQL project. You'd also need to write a regression test suite for
your client, to make sure you handle all supported features of the protocol.

Regards,
Bill K.
Jul 23 '05 #5
> TCP/IP is a communications protocol

Of course! It sure wouldn't work very well if it was a poodle :-)

I thought that:
I just want to send stuff over a port and
get an answer back.
Certainly explains pretty well what I want to do.
As a result what you want to do
isn't supported and isn't likely
to be supported.


Of course it is. That's how libmysql.c does what it does. That's what the
command line client uses and that's what PHP uses. That's what nearly
everything uses.

Consider: connect to a mysql server on 3306 (or whatever your server port
is) and read a result as ASCII text terminated by CRLF. You get "6" (or at
least I do). That means something. The question is what? Now, with the
command line client connected to a server, issue "use testdb;". How is
exactly the same thing done with 3306? I suppose I could sniff the
conversation but I really don't want to start from square one.

I'm not writing OS components and I'm not changing anything about TCP/IP. I
just want to converse with a server without using the CLC, MyODBC or any
other such library. They are not options. The only option I have available
is TCP/IP.

--
-SHAWN-
Jul 23 '05 #6
> I strongly recommend against you
duplicating this effort by writing
your own client interface directly
at the TCP/IP level.


That is *precisely* what I have to do. If I could use the C API I would. If
I could use any library at all I would. I can't. This language that I'm
using does not expose external libraries to the programming environment. A
form of socket is available and that's I get.

I don't need to duplicate libmysql in it's entirety. All I need to be able
to do is execute simple queries and add and delete records. It's not that
big a deal.
--
-SHAWN-
Jul 23 '05 #7
Shawn Fessenden wrote:
I don't need to duplicate libmysql in it's entirety. All I need to be able
to do is execute simple queries and add and delete records. It's not that
big a deal.


Heh! Reminds me of one of my first contract programming offers, right
out of school. A guy wanted to hire me (at a fixed bid) to write a
subset of SQL using shell scripts and awk. He said, "you only have to
support one command from SQL. I only need SELECT implemented."

I think you're opening yourself up for a nasty headache if you try to
write code to talk directly to port 3306. But I still say that's not
the only way to solve you problem.

Given the constraints, what I would do in this situation is write my own
simple server that functions as a middleware, or proxy, for the simple
queries that you're describing.

That is, you write a client that talks to (for instance) port 3406, and
you also write a server that listens on port 3406. Your server would
typically run on the same host as the MySQL instance, but it doesn't
have to.

Then your server in turn uses the MySQL API, translating your simple
subset of specialized queries into the standard MySQL-provided API
calls, to talk to the MySQL client/server protocol. So your code
defines both ends of your custom client/server protocol, and therefore
it doesn't risk getting out of sync with the MySQL protocol implementation.

You could alternately use MySQL Connector/J or something else to write
your middleware server, depending on what language you want to use to
program the server. You should be less constrained for what language
you use, you could use anything that runs on the same platform as your
MySQL instance.

Regards,
Bill K.
Jul 23 '05 #8
> Heh! Reminds me of one of my first
contract programming offers, right
out of school.


Oh yeah, been there!
Thank god it was back when we were still writing assembly. Remember Tarbell?
:-)

At any rate, thanks for your thoughts Bill. The server won't allow a shell
and doesn't run Telnet (or any other server for that matter), so all that's
out.

As for a proxy - I see the wisdom but the Powers have already rejected doing
anything with the server. This is a very niche thing. The client app doesn't
have access to a whole lot resource-wise. If you think embedded you're on
the right track.

Soooo ... I will simply accept the fact I ain't gonna get help. I'll snort
the port and see what I can come up with. I did finally find libmysql.c so
I've got everything I need now.
--
-SHAWN-
Jul 23 '05 #9
Shawn Fessenden wrote:
As for a proxy - I see the wisdom but the Powers have already rejected doing
anything with the server. This is a very niche thing. The client app doesn't
have access to a whole lot resource-wise. If you think embedded you're on
the right track.


So you can't install anything on the client, _or_ the server. Perfect...
I wish you great luck on this project -- you'll need it!

Regards,
Bill K.
Jul 23 '05 #10
> So you can't install anything on the client, _or_ the server.

Correct.
I wish you great luck on this project -- you'll need it!


Well I just now happened to be chatting with a friend of mine who is also a
MySQL fan and he passed me this most helpful link:

http://www.redferni.uklinux.net/mysq...-Protocol.html

This is exactly what I was looking for. Clients don't want to hear this or
that can't be done or you're an idiot for trying. Such answers don't keep
the cupboard full. Fortunately this time I got lucky. This project will be
in the bag in two days. As I suspected, it's really not that big a deal.
--
Jul 23 '05 #11

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

Similar topics

63
by: Jerome | last post by:
Hi, I'm a bit confused ... when would I rather write an database application using MS Access and Visual Basic and when (and why) would I rather write it using Visual Studio .Net? Is it as easy...
13
by: bill | last post by:
I am trying to convince a client that dotNet is preferable to an Access project (ADP/ADE). This client currently has a large, pure Access MDB solution with 30+ users, which needs to be upgraded....
1
by: Dave | last post by:
Hello NG, Regarding access-declarations and member using-declarations as used to change the access level of an inherited base member... Two things need to be considered when determining an...
13
by: Simon Bailey | last post by:
I am a newcomer to databases and am not sure which DBMS to use. I have a very simplified knowledge of databases overall. I would very much appreciate a (simplifed) message explaining the advantages...
0
by: Frederick Noronha \(FN\) | last post by:
---------- Forwarded message ---------- Solutions to Everyday User Interface and Programming Problems O'Reilly Releases "Access Cookbook, Second Edition" Sebastopol, CA--Neither reference book...
20
by: Olav.NET | last post by:
I am a .NET/C++ developer who is supposed to do some work with Access. I do not know much about it except for the DB part. Questions: *1* I am looking for INTENSIVE books to get quickly up to...
64
by: John | last post by:
Hi What future does access have after the release of vs 2005/sql 2005? MS doesn't seem to have done anything major with access lately and presumably hoping that everyone migrates to vs/sql. ...
1
by: com | last post by:
Extreme Web Reports 2005 - Soft30.com The wizard scans the specified MS Access database and records information such as report names, parameters and subqueries. ......
17
by: Mell via AccessMonster.com | last post by:
Is there a way to find out where an application was created from? i.e. - work or home i.e. - if application sits on a (work) server/network, the IT people know the application is sitting...
37
by: jasmith | last post by:
How will Access fair in a year? Two years? .... The new version of Access seems to service non programmers as a wizard interface to quickly create databases via a fancy wizard. Furthermore, why...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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 project—planning, coding, testing,...

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.