Search code examples
mysqldatabaseconceptual

MySQL help figuring out structure of databases


I am a java programmer trying to make the jump to web development and database management. I am trying to figure out the structure of web services in general and I will try to ask some questions that lead to definite non-abstract answers, but I barely understand MySQL so please forgive me if my question has no answer, or is wrong or something.

I understand the concept of a relational database, but I don't understand the how it is implemented in MySQL or SQL in general. Is there a database file somewhere I don't know... Basically my question is how does MySQL store databases and what is the proper way to interact with them?

also is there a way to set up a MySQL database that is not on a server?


Solution

  • Follow the directions here: http://docs.oracle.com/javase/tutorial/jdbc/basics/gettingstarted.html , for MySQL.

    Most RDBMSs, including MySQL, are implemented as servers to which your Java program connects using the JDBC interfaces. There are a few that have local files -- derby, sqlite, access -- but not in general.

    Basically, it goes like this:

    Java program issues a connect request to a server.

    RDBMS Server accepts connect request.

    Java program prepares a SQL query, like

     SELECT name, address FROM customer WHERE status = 'active' and zip = ?
    

    Java program binds variables to the query. e.g. variable 1 = string '90210'.

    Java program issues query.

    RDBMS carries out query, and sends a result set to Java.

    Java program receives result set row - by - row and does what it needs to do