Find the answer to your Linux question:
Results 1 to 10 of 10
I would like to connect to MySQL (on Linux Server) using an ASP or JSP (created on Win98 PC). If my SQL databases are located at /usr/sbin/mysqld but my website ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2003
    Location
    Southeastern Indiana
    Posts
    13

    MySQL Connection


    I would like to connect to MySQL (on Linux Server) using an ASP or JSP (created on Win98 PC). If my SQL databases are located at /usr/sbin/mysqld but my website is located at /home/httpd/html, will the webpage be able to find the database to access it.

    I've also installed MySQL ODBC driver for MS Access 2000. But I can't get a connection. Could that also be the problem there?

    I'm running MySQL on a Compaq Proliant Server with Red Hat Linux 6.2 as the OS and Apache.

    My PC is running Windows98 with Access 2000 and Macromedia Studio MX for developing webpages. I'm using Samba to connect my PC with the /home directory of Apache to update the webpages.

    Both are connected to our LAN with a 10/100 connection through a switch.

    Can anyone help me with this problem.

    Let me know if more information is needed.

    Thanks.

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Well, first I'd like to clear up a little misconception that you seem to have. Your databases are not located at /usr/sbin/mysqld. That's you MySQL daemon binary. The databases are usually in /var/lib/mysql. But that doesn't matter, since that's one of the features of mysqld, to make SQL queries available over the network. The HTTP server doesn't access the database directly, it connects to mysqld at port 3306 to query the database.

    If you can't connect to it, I can think of four causes:
    1. Are you sure that your ODBC settings are correct?
    2. Are you sure that mysqld is running?
    3. Do you have a firewall blocking the port?
    4. Have you granted access to the connecting computer?

  3. #3
    Just Joined!
    Join Date
    May 2003
    Location
    Southeastern Indiana
    Posts
    13
    I suppose mysqld is running. I'm using WebMin to adminster MySQL and I'm able to work with it from there.

    The server is in-house and will only be accessed from within our own network, so the external firewall should not be an issue.

    I've just recently begun working with Linux, Tomcat, and MySQL.

    Any help you can provide is greatly appreciated.

    Thanks.


  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I wasn't worrying about the external firewall. I was worrying about if you had set up a firewall on the local machine. It happens all the time that people have set their security level to medium or high during the installation, and then report all kind of problems relating to programs that cannot connect.
    As for my other suggestions, then? Have you reverified your ODBC settings, and have you granted access to the database?

  6. #5
    Linux Engineer
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    796
    Try to log as the user you have specified on your webpages...if you have created the user and granted him to the database and the specific tables.

    Code:
    mysql -A databasename -u username -p
    If that doesnt work something is wrong...look at my mysqlhowo on my site..maybe it can help you.

    http://www.utterberg.com/

    Regards
    Regards

    Andutt

  7. #6
    Just Joined!
    Join Date
    May 2003
    Location
    Southeastern Indiana
    Posts
    13
    I have MySQL running and have a database create and working on it. I'm interfacing with MySQL through WebMin currently.

    I would like to set up JDBC with a connection to MySQL so I can create JSP in Macromedia Dreamweaver MX.

    I've installed MySQL Connector/J

    I'm not sure where to go from here.

    The instructions that I have from the MySQL Connector/J Documentation are confusing to me.

    Any help is greatly appreciated.

    Thanks.

  8. #7
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I'm sorry, but I've never used either WebMin, Dreamweaver or the JDBC connector. I tend to use the good old replacments for these called shell, emacs and php. I mean, I have all the respect for Java, but in my opinion it is still clearly overrated.
    So, sorry, I can't help you with those tools.

  9. #8
    Linux Engineer
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    796
    I´m sorry to say that i havent used jdbc drivers either..the best way is to test the stuff throw a terminal to see if you can access the database from there with your user and password and the try to go further...

    Did you get any errormessage from webmin??

    Regards
    Regards

    Andutt

  10. #9
    Just Joined!
    Join Date
    May 2003
    Location
    Southeastern Indiana
    Posts
    13
    In WebMin, I can access the MySQL database perfectly.

    Does anyone know where I should add my connection string?

    Is it correct?

    jdbc:mysql://[mcphersons]:[3306]/[MSDS] [username] [password]

  11. #10
    Just Joined!
    Join Date
    Jun 2003
    Location
    Helsinki, Finland
    Posts
    78
    This page http://www.mysql.com/documentation/c...html#id2763872 has an example on it.

    That looks ok. (It's been a while since I used jdbc). So mcphersons is the database machine? MSDS is the name of the database? According to the above example, you need a Question Mark (?) after the databsae.

    I'm not sure about the way you specified the username and password. The ap documentationEither you add it to the url such as
    Code:
    .....databasename?user=someName&password=secret
    or
    Code:
    ...databasename, someName, secret)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •