I've just started try to do some programming on a Linux based system, after years of working in WinDoze.
One of the first hurdles I'm facing is that the current project requires accessing a remote MySql server (remote, but on the same LAN).
I'm assuming its possible to set up some sort of ODBC service, but for the life of me I can't find out the right way to do this. Has anyone got any hints please?
I'm using NetBeans or KDevelop, as my programming environment, it that affects anything :P
On Fri, Mar 14, 2003 at 10:05:46PM +0000, Tony Dietrich wrote:
One of the first hurdles I'm facing is that the current project requires accessing a remote MySql server (remote, but on the same LAN).
I'm assuming its possible to set up some sort of ODBC service, but for
I can't contribute very much here, but forget about ODBC right now. It's solely a Windows idea (JDBC, on the other hand, does exist. Confusing, a?). The MySQL dox will tell you how to connect to a remote server, but I can't tell you myself.
You might want to look here as well, although I appreciate you may not have had a say in choosing MySQL: http://openacs.org/philosophy/why-not-mysql
Alexis
Tony Dietrich td@transoft.demon.co.uk wrote:
One of the first hurdles I'm facing is that the current project requires accessing a remote MySql server (remote, but on the same LAN).
At the simplest level, you can just ask MySQL to listen to a TCP port and use the MySQL client libraries on the calling machine to contact the server. Some languages (eg Scheme) even have native interfaces to database server TCP connections, so you don't need the client libraries, but I doubt that's true for the language you're using (does KDevelop mean you're using C++?).
Of course, to be a bit more portable, you could use ODBC via an ODBC connector for MySQL (eg unixodbc I think), but that might be more long-winded than you need.
Hope that helps,
Thanks for the suggestions everyone :-)
I've settled on JDBC for the time being, since I'm much happier in java than C++, and I have a valid JDBC driver on this system that I can use to connect to a local db ... however, the application is designed to connect to a central mysql server, and so far I can't seem to find out how to do this ....
any ideas (please!) ... surfing the web, I get lots of help in connecting to a local sql server, but none seem to refer to connecting to a remote sql server :-(
if you are using java (I asume you are as you are using netbeans) you can connect with
Class.forName("org.gjt.mm.mysql.Driver").newInstance(); Connection connection = DriverManager.getConnection( "jdbc:mysql://[server ip address]:[port]/[database]", "user", "password");
you need add the package org.gjt.mm.mysql.Driver to your class path
Tony Dietrich wrote:
Thanks for the suggestions everyone :-)
I've settled on JDBC for the time being, since I'm much happier in java than C++, and I have a valid JDBC driver on this system that I can use to connect to a local db ... however, the application is designed to connect to a central mysql server, and so far I can't seem to find out how to do this ....
any ideas (please!) ... surfing the web, I get lots of help in connecting to a local sql server, but none seem to refer to connecting to a remote sql server :-(
if you are using java (I asume you are as you are using netbeans) you can connect with
Class.forName("org.gjt.mm.mysql.Driver").newInstance(); Connection connection = DriverManager.getConnection( "jdbc:mysql://[server ip address]/[database]");
you need add the package org.gjt.mm.mysql.Driver to your class path
Tony Dietrich wrote:
I've just started try to do some programming on a Linux based system, after years of working in WinDoze.
One of the first hurdles I'm facing is that the current project requires accessing a remote MySql server (remote, but on the same LAN).
I'm assuming its possible to set up some sort of ODBC service, but for the life of me I can't find out the right way to do this. Has anyone got any hints please?
I'm using NetBeans or KDevelop, as my programming environment, it that affects anything :P
Thanks :-)
I've tried that .. or at least, I've tried testing a database connection from inside NetBeans using the same connection parameters as you suggest,
testing a local database using #
jdbc:mysql://localhost/pp1
succeeds (I have a copy of the database on the local machine, IP 192.168.0.2), but
jdbc:mysql://192.168.0.1:3306/pp1
gives me..
"Server configuration denies access to data source"
Any suggestions? I refuse to give up! <g>
(btw, I do have a mysql hosts permission on 192.168.0.1 for IP 192.168.0.2, for all databases)
On Sat, 2003-03-15 at 12:30, simon wrote:
if you are using java (I asume you are as you are using netbeans) you can connect with
Class.forName("org.gjt.mm.mysql.Driver").newInstance(); Connection connection = DriverManager.getConnection( "jdbc:mysql://[server ip address]/[database]");
you need add the package org.gjt.mm.mysql.Driver to your class path
Have you tried adding a valid user name and password for the remote Mysql server to the getConnection() method
Connection connection = DriverManager.getConnection( "jdbc:mysql://[server ip address]:[port]/[database]", "user", "password");
Simon
Tony Dietrich wrote:
Thanks :-)
I've tried that .. or at least, I've tried testing a database connection from inside NetBeans using the same connection parameters as you suggest,
testing a local database using #
jdbc:mysql://localhost/pp1
succeeds (I have a copy of the database on the local machine, IP 192.168.0.2), but
jdbc:mysql://192.168.0.1:3306/pp1
gives me..
"Server configuration denies access to data source"
Any suggestions? I refuse to give up! <g>
(btw, I do have a mysql hosts permission on 192.168.0.1 for IP 192.168.0.2, for all databases)
On Sat, 2003-03-15 at 12:30, simon wrote:
if you are using java (I asume you are as you are using netbeans) you can connect with
Class.forName("org.gjt.mm.mysql.Driver").newInstance(); Connection connection = DriverManager.getConnection( "jdbc:mysql://[server ip address]/[database]");
you need add the package org.gjt.mm.mysql.Driver to your class path
Yep :-((
No luck
On Sat, 2003-03-15 at 12:51, simon wrote:
Have you tried adding a valid user name and password for the remote Mysql server to the getConnection() method
Connection connection = DriverManager.getConnection( "jdbc:mysql://[server ip address]:[port]/[database]", "user", "password");
Simon
Does the user you are connecting as have all privileges on the database
GRANT ALL PRIVILEGES ON *.* TO app@ % ;
app being your connecting user
Simon
Tony Dietrich wrote:
Yep :-((
No luck
On Sat, 2003-03-15 at 12:51, simon wrote:
Have you tried adding a valid user name and password for the remote Mysql server to the getConnection() method
Connection connection = DriverManager.getConnection( "jdbc:mysql://[server ip address]:[port]/[database]", "user", "password");
Simon
On Sat, 15 Mar 2003, Tony Dietrich wrote:
jdbc:mysql://localhost/pp1
succeeds (I have a copy of the database on the local machine, IP 192.168.0.2), but
jdbc:mysql://192.168.0.1:3306/pp1
gives me..
"Server configuration denies access to data source"
What happens if you try accessing the machine using the mysql command-line client? ie:
mysql -u user -p -h 192.168.0.1 pp1
?
Andrew.
Host "primary.<....>" is not allowed to connect to this MySQL server.
This is in spite of the fact that, using webmin, I have created a valid user with full access permissions on that db, and host permissions for the local machine, both in numeric form and FQDN form
On Sat, 2003-03-15 at 13:05, Andrew Savory wrote:
On Sat, 15 Mar 2003, Tony Dietrich wrote:
jdbc:mysql://localhost/pp1
succeeds (I have a copy of the database on the local machine, IP 192.168.0.2), but
jdbc:mysql://192.168.0.1:3306/pp1
gives me..
"Server configuration denies access to data source"
What happens if you try accessing the machine using the mysql command-line client? ie:
mysql -u user -p -h 192.168.0.1 pp1
?
Andrew.
-- All views are my own .... who else would want them?
main@lists.alug.org.uk http://www.alug.org.uk/ http://lists.alug.org.uk/mailman/listinfo/main Unsubscribe? See message headers or the web site above!
Is the firewall setup on the RH8 box ??
Simon
Never be afraid of trying something new, remember :
Amateurs built the Ark.... Professionals built the Titanic....
I've tried with the firewall up and the firewall down :-(
TD
On Sun, 2003-03-16 at 10:27, Simon wrote:
Is the firewall setup on the RH8 box ??
Simon
Never be afraid of trying something new, remember :
Amateurs built the Ark.... Professionals built the Titanic....
As a follow-on FYI, I've d/loaded the MyODBC/J package, and have the .jar file from that package in the CLASSPATH, and NetBeans seems to recognise it.
On Sat, 2003-03-15 at 12:30, simon wrote:
if you are using java (I asume you are as you are using netbeans) you can connect with
Class.forName("org.gjt.mm.mysql.Driver").newInstance(); Connection connection = DriverManager.getConnection( "jdbc:mysql://[server ip address]/[database]");
you need add the package org.gjt.mm.mysql.Driver to your class path
Tony Dietrich wrote:
I've just started try to do some programming on a Linux based system, after years of working in WinDoze.
One of the first hurdles I'm facing is that the current project requires accessing a remote MySql server (remote, but on the same LAN).
I'm assuming its possible to set up some sort of ODBC service, but for the life of me I can't find out the right way to do this. Has anyone got any hints please?
I'm using NetBeans or KDevelop, as my programming environment, it that affects anything :P
main@lists.alug.org.uk http://www.alug.org.uk/ http://lists.alug.org.uk/mailman/listinfo/main Unsubscribe? See message headers or the web site above!