Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Connecting to mysql without installing driver

807580Jul 28 2010 — edited Aug 1 2010
Right before some tells me this is not the place to post this question, I would like to know if there is a way to connect to a mysql database without installing a driver, I know it is impossible but the reason I said it is because I have been given a task to convert an app created in excel vba to a web based app. I have the option of doing it in php/java. Im paticularly interested in java; but in order to write a java app that connects to the mysql. I need to have supervisor right to access my control panel to install the connector/J driver, since this is a company laptop everything is closed off. My main question is can I get round this in regards to creating an app that can access the mysql db without needing to install the driver in to the reg-edit. Before anyone tells me that I have to install the driver on the environment variable; I do not have access to that area as the laptop is connected to an internal company network. Is there a way round it. I remember running a simple java app via a bat file, because I culd not access dos/control panel. does anyone know whther this will work connecting mysql

Here is an example of code that I'm talking about
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Connect {

  public static void main(String args[]) {
    Connection con = null;

    try {
      Class.forName("com.mysql.jdbc.Driver").newInstance();
      con = DriverManager.getConnection("jdbc:mysql:///test","root", "moyo");

      if(!con.isClosed())
        System.out.println("Successfully connected to " +
          "MySQL server using TCP/IP...");

    } catch(Exception e) {
      System.err.println("Exception: " + e.getMessage());
    } finally {
      try {
        if(con != null)
          con.close();
      } catch(SQLException e) {}
    }
  }
}
Obviously I know why it is coming out with an exception error is because it cannot connect to the mysql db, but as I said I cannot install the connector driver on the client side computer; since this app will be used by 500 people; this will mean installing the driver on 500 compouters or more, is there away around this. Please helppppp!!!!!!!!!!!!!!!!!!!!!111
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 29 2010
Added on Jul 28 2010
15 comments
2,424 views