1 2 Previous Next 15 Replies Latest reply on Aug 1, 2010 4:49 PM by 807580

    Connecting to mysql without installing driver

    807580
      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
        • 1. Re: Connecting to mysql without installing driver
          807580
          I don't get this! If you can run a jar file then you can un-jar the MySQL driver jar and include the classes in your master jar file. Even this seems redundant if your computer is locked down but you can still install your master jar file since if you can install one jar file you should be able to install many.

          The only reason I can think of why this may not work is if you are not allowed to open sockets.
          • 2. Re: Connecting to mysql without installing driver
            807580
            If you do not have access to your LAN, then you should not be writing anything for your company or for multi-use use. IMO: if your own IT depeartment doesn't trust you, why should we?
            • 3. Re: Connecting to mysql without installing driver
              DrClap
              citizenXL wrote:
              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.
              Come on. Don't go on public web sites and ask for advice on how to break your company's security. If somebody in your company has designated you to write an application which requires you to get a JDBC driver and use it, then they will have to enable you to do it. If that requires somebody signing in as "administrator" and standing beside you while you set things up, or filling paper work and waiting six weeks while the security committee approves your right to change your compiler's class path, then so be it. Do that. If you can't get your work done because of security policies, then tell your manager that. If nothing changes, you won't be able to get the project done. It's your manager's responsibility to deal with that problem, not yours.
              • 4. Re: Connecting to mysql without installing driver
                EJP
                I would like to know if there is a way to connect to a mysql database without installing a driver
                Yes there is.
                I know it is impossible
                No it isn't.
                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
                No you don't. You only need the mysql-connector.jar or whatever it's called. You only need to add Data Sources via the Control panel for the existing VBA application, and you need supervisor rights for that, but surely everybody in the corporation already has it installed so they can run the existing application?

                But, as everybody else has been saying, surely you can get that running without subterfuges or asking on public forums? They are paying you to do this you know, it's their money.

                In any case it is certainly not a Java question.
                • 5. Re: Connecting to mysql without installing driver
                  807580
                  First of all I'm not some teen hacker trying to hack in to my company's LAN, if I was I would not be wasting my time asking how it can be done I could easily do that, the reason I'm asking this is because the alternative would be to install an seperate driver on each machine which would then link to the mysql db, the only problem with this, if one of the staff looses there computer, to apply for the odbc/jconnect driver we have to write a business case; fill up 20 page form with a justification on why we need it. 2nd, as I've said before we are replacing an application that was built on excel with an access db (backend). We figured that we could either go via the php platform where everything is stored on there server (hence no need for an odbc link;) or use java because of it ease use in regards to using the swing api to create a rich user interface i.e. multi tab pages, 2d graphics etc. So the bottom line is can i run the application without having to install the driver on to my computer or better still can create the same java application using a java applet to connect to the mysql db. By the way the mysql db is not some illegal db. I already have approval for that. I'm just trying to figure out what platform solution is a better alternative to using an excel front end that connects to access db (stored on a shared drive that constantly breaking down because if someone moves the db to another location we are in trouble
                  • 6. Re: Connecting to mysql without installing driver
                    807580
                    Again I think people have misunderstood what I'm asking we have been asked to come up with a better alternative to a current vba application that is connected to an access db through a DAO recordset; we are stuck between a php or java platform. The reason we are swinging towards java is because creating a gui with swing components seems to be more accessable the php. For example one of the function of the vba app was to create hyperlinks that pointed to differnt parts of the db via a tree view components. Trying to create this on php requires me searching for a tree component where as swing I can use one of the many components swing offers. Again if know one understands this problem I am trying to convert a vba app that connects to an access db to a web based solution or a java app/applet
                    • 7. Re: Connecting to mysql without installing driver
                      807580
                      It's trivial to shove results from a ResultSet into Swing widgets.

                      But what was all that talk about bypassing security etc.?

                      And why are you so opposed to just using mysql drivers? You don't need to have admin access to your box to do that anyway. Database drivers for JDBC are not the same thing as Windows drivers; you know that, right?
                      • 8. Re: Connecting to mysql without installing driver
                        807580
                        1. The company does not use mysql, we use oracle; hence no mysql drivers on the computers
                        2. Ive only been programming in java for 3 mnth sporadiclly via books like thinking in java by bruce eckels & teach yourself java in 21 days
                        3. if I don't need access to the control panel could you please tell me what I'm doing wrong when I run this code that connects to a mysql db which is sitting on the xampp server
                        • 9. Re: Connecting to mysql without installing driver
                          807580
                          So your company is fine with you installing a MySQL server, but not with dropping a MySQL driver on your disk.
                          Even though doing so will not affect your OS at all, and isn't a security problem in any way.
                          And they also have no problem with you bypassing other security rules.

                          Re: what you're doing wrong: who knows.
                          • 10. Re: Connecting to mysql without installing driver
                            793415
                            citizenXL wrote:
                            ..trimmed 8 lines..
                            Wow! Take a breath, dude.
                            .. So the bottom line is can i run the application without having to install the driver on to my computer or better still can create the same java application using a java applet to connect to the mysql db. ..
                            Is that a question? Questions in English should end in a question mark (?). Please add question marks to questions so they are easier to identify in:
                            a) Large blocks of text.
                            b) Text searches for '?'.

                            In any case, assuming it is a question.

                            What happened when you tried it? I am guessing that if these machines are not entirely locked down, that it will work.

                            Further, if that works, launch a rich client desk-top application (free-floating, outside a web page) using [Java Web Start|http://www.oracle.com/technetwork/java/javase/tech/index-jsp-136112.html] *(<- link)* should also work. JWS offers many advantages over applets.
                            • 11. Re: Connecting to mysql without installing driver
                              EJP
                              3. if I don't need access to the control panel
                              You don't. I am using MySQL here from Java with no control panel drivers installed. QED.
                              could you please tell me what I'm doing wrong
                              Hard to say when we don't know what you're doing.
                              when I run this code
                              What code?
                              that connects to a mysql db which is sitting on the xampp server
                              and what happens next? or instead?
                              • 12. Re: Connecting to mysql without installing driver
                                807580
                                All right lets start again

                                We have an applications where the front-end was built using excel; the back-end is an access database stored on a shared drive. Now unfortunately we sometimes run out of space to; hence the application runs extremely slow or grinds to halt; we also have problems with people accidently deleting or moving the access db by mistake. Yes we could easily place it in a security group & limit people who have access to it, but as the company is trying to phase out access use they don't see the point of it, hence they want it upgraded to a web based solution or a solution that does not require microsoft access use.

                                Our first solution was to upgrade it to a php platform front-end with a mysql back-end (database driven web site). This will be hosted on an external server. The company has no problem with this as the application will not be extracting/communicating any sensitive data, but since the original app contained widgets like multi tabs, treeview links. To transfer all this to a php platform would mean incorporating css in to the php platform. I personally don't have a problem with css, but as the company is still stuck on IE.6 and has no intention of upgrading the browser; we figured we would be limited with what we could do. Hens we came up with a java solution mainly because transferring all the ui components from the excel front end would be easy, because java has swing components, which would mean not having to create them.

                                Now as I said the original excel app we did not have to worry about odbc connection as the access db was in a shared drive and we used dao record sets to fetch rows of data. I know with the php platform it's the same because everything is on an external server, but what I'm asking is with a java app that has more then 100 users need a driver (j-connect, JDBC etc ) on each machine to make a connection with a mysql db that is held on an external server (bear in mind the company has no problem with the mysql db being on an external server).

                                I'm not trying to pull a jewel heist. I just want to try and figure out which path I should take, the PHP path or Java path!!!!!!!
                                • 13. Re: Connecting to mysql without installing driver
                                  807580
                                  citizenXL wrote:
                                  All right lets start again
                                  [snip]
                                  I'm not trying to pull a jewel heist. I just want to try and figure out which path I should take, the PHP path or Java path!!!!!!!
                                  As you said, the pro for the PHP route are that it requires no client install. The con is that it's harder to build a feature-rich UI with HTML & Javascript

                                  The pro for the Swing app is that it's (relatively) easier to build a feature-rich UI, but it requires a client install.

                                  I don't understand what the issue is around the MySQL JDBC driver jar, as that's just part of your client install.

                                  As someone else mentioned, you can go the Java Web Start route which handles the client install for you.

                                  Good Luck

                                  Lee
                                  • 14. Re: Connecting to mysql without installing driver
                                    807580
                                    citizenXL wrote:
                                    what I'm asking is with a java app that has more then 100 users need a driver (j-connect, JDBC etc ) on each machine to make a connection with a mysql db that is held on an external server (bear in mind the company has no problem with the mysql db being on an external server).
                                    All you'd have to do is let the user install the MySQL JDBC driver along with the jar file holding the application. And actually you might not even need to install it (you could just make it available on the server and let Java load the class over the net). It really wouldn't be that bad.

                                    But if you want it to be a web app, you wouldn't even do that. Don't make the Java app that runs on the browser directly connect to the MySql db. A more canonical (and secure) design would be to have the server-side web app connect to the database, and the Java clients would connect to the web server to communicate to the server-side web app. All JDBC would be happening purely on the server. The clients would talk to the server over HTTP.

                                    Of course, this might require that the users have Java installed, and you seem loathe to make the users install anything. What's the bare minimum level of stuff installed on the client machines right now?

                                    Note that you can do CSS on MSIE 6. It's just a broken, awful, incompatible version of CSS. You might still be better off writing a web app that only uses a browser for the client.
                                    1 2 Previous Next