Professional Web Applications Themes

Connecting to mySQL database over the LAN - MySQL

Hello Everyone, I am using java API's and JDBC to connect to a mySQl server which is present in the LAN and i use the IP address of the server to specify the connection URL but I always get the connection error exception during run time and I have installed the jconnector so i can use the JDBC connections to the SQL server and added it to my CLASSPATH environment varriable but still get the same error some one please help me out. thanks in advance, Mithil...

  1. #1

    Default Connecting to mySQL database over the LAN

    Hello Everyone,

    I am using java API's and JDBC to connect to a mySQl server which is
    present in the LAN and i use the IP address of the server to specify
    the connection URL but I always get the connection error exception
    during run time and I have installed the jconnector so i can use the
    JDBC connections to the SQL server and added it to my CLASSPATH
    environment varriable but still get the same error some one please
    help me out.

    thanks in advance,
    Mithil

    Mithil Guest

  2. #2

    Default Re: Connecting to mySQL database over the LAN

    Mithil wrote: 

    Does the remote server allow you to connect from your location?
    By default when setting up users, they are only granted to connect from the
    localhost.


    --

    //Aho
    J.O. Guest

  3. #3

    Default Re: Connecting to mySQL database over the LAN

    Thanks for the reply Aho. I am logging in as the root when i am
    specifying the username and password so I think that shouldn't make a
    difference it actually fails at the point when i am creating the
    driver
    Class.forName ("com.mysql.jdbc.Driver") that is the exception it
    throws. I am sorry I should have mentioned this earlier.

    Mithil Guest

  4. #4

    Default Re: Connecting to mySQL database over the LAN

    On 20 Mar 2007 06:03:57 -0700, Mithil wrote: 

    You keep getting the same error, but you haven't told us what the error
    says. "Help! My car won't start! What's wrong?"

    --
    79. If my doomsday device happens to come with a reverse switch, as soon as it
    has been employed it will be melted down and made into limited-edition
    commemorative coins.
    --Peter Anspach's list of things to do as an Evil Overlord
    Peter Guest

  5. #5

    Default Re: Connecting to mySQL database over the LAN

    it states in my second message, it is an exception actually it doesn't
    create the driver for some reason , the exception occurs in this
    statement :

    Class.forName ("com.mysql.jdbc.Driver")

    but i have the jconnector's jar file set to the classpath and also
    copied it into the library files of the JVM as said by the doent
    for the jconnector.

    I am sorry for not giving the exact error because I am at work and
    don't have my PC which i use in college sorry will type in the exact
    error message tomorrow sorry for any problems.

    Mithil Guest

  6. #6

    Default Re: Connecting to mySQL database over the LAN

    I am sorry for all the trouble of not putting up my Question properly
    the error i get is :

    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver


    when I run the code:

    import java.sql.*;
    import java.lang.*;

    public class testingJDBC {

    /** Creates a new instance of testingJDBC */
    public testingJDBC() {
    }



    public static void main(String argsp[]){
    try{
    Statement stmt;
    Class.forName("com.mysql.jdbc.Driver").newInstance ();
    String url ="jdbc:mysql://147.25.238.215:3306/test";
    Connection con =DriverManager.getConnection(url,"root",
    "000000");
    stmt = con.createStatement();
    stmt.executeUpdate("CREATE DATABASE JunkDB");
    }
    catch(Exception e){
    System.err.println("connection cann't be established
    \n"+e);
    }
    }
    }


    Please help me out I am stuck at this point.

    Thanking you in advance,
    Mithil

    Mithil Guest

  7. #7

    Default Re: Connecting to mySQL database over the LAN

    On 21 Mar 2007 06:16:05 -0700, Mithil wrote: 

    Perhaps I do not know Java very well. This sounds like an error
    indicating that
     

    this line above is the one causing the problem, because it is not where
    the interpreter/compiler/runtime enviornment is expecting it to be.
     


    --
    100. Finally, to keep my subjects permanently locked in a mindless trance, I
    will provide each of them with free unlimited Internet access.
    --Peter Anspach's list of things to do as an Evil Overlord
    Peter Guest

Similar Threads

  1. Connecting to an online mysql database
    By TH856 in forum Coldfusion Server Administration
    Replies: 2
    Last Post: May 7th, 05:14 PM
  2. connecting to MySql database
    By notesqueen in forum Dreamweaver AppDev
    Replies: 13
    Last Post: August 15th, 09:46 PM
  3. Connecting to MySQL Database problem
    By Scott in forum Dreamweaver AppDev
    Replies: 7
    Last Post: July 29th, 08:05 AM
  4. Problems connecting to MySql database
    By jonparadise2 in forum Dreamweaver AppDev
    Replies: 2
    Last Post: June 27th, 10:43 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139