I just implemented a remote java client that accesses a remote mysql server
and
while it's still fresh in my head... I thought I'd share the high points with
you. 

First off... server side... using the mysql client named... "mysql" be
certain to setup a
client that can accept connections outside of local. Over here it sufficed to
use this
grant command line:

grant (your specific privilege options) on (database) to mcbrides@'%'
identified by 'password' with grant option;

If you need plain text passwords... do this:

grant (your specific privilege options) on (database) to mcbrides@'%'
identified by password 'password' with grant option;

What the "%" does is allow incomming connections from anywhere from user
mcbrides with the correct password. 

Also, setup the same client to use "mcbrides@localhost".  I was getting
random errors
from the jre about not being able to use localhost. This fixed that.. :')

On the remote, client side your java/netrexx should look like:

  do
    
  Class.forName("org.gjt.mm.mysql.Driver");
  
--
-- the above line specifies the MM jdbc driver.
--

 
con=DriverManager.getConnection("jdbc:mysql://192.168.0.190:3306/stihl","user_name","password")

-- the above line "decodes to: 
--
--"jdbc//mysql//SERVER_IP_ADDRESS:PORT/DATABASE_NAME"
--"USER_NAME",:USER_PASSWORD"
--
  stmt = con.createStatement()
  catch e=Exception
     Say'Caught unexpected error :'e.getMessage()
     e.printStackTrace()
     exit 1
  end -- do


Once the above code snip opens the database on the server, you can begin to
process your sql commands as you normally would.

I just thought I'd share this with you guys. It wasn't so obvious to me at
first. What 
I'm doing is breaking out a local mysql client and modifying it for remote
operations
in a class C lan.

Really nice stuff. The neat part is, you can hardly tell the dfference
between local and remote operations.

I've got the complete source to this project and... boy... the possibilities
are endless.

-- 

******************************************************************************
                     Registered Linux User Number 185956
          http://groups.google.com/groups?hl=en&safe=off&group=linux
         2:10pm  up 21:17,  2 users,  load average: 0.00, 0.00, 0.00

_______________________________________________
Linux-users mailing list
Archives, Digests, etc at http://linux.nf/mailman/listinfo/linux-users

Reply via email to