#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    2
    Rep Power
    0
    Hi, guys:
    I am trying to connect Mysql with jdbc. however, I got the problem as following,
    1). The following is my source code of java:
    public DataAccess(String connect) {
    connect = "jdbc:mysql://192.168.0.101:3306/test_db?user=mysql&password=mysql";
    String driver_class = new String("org.gjt.mm.mysql.Driver");
    try {
    if (conn == null) {
    Driver riverName = (driver) Class.forName(driver_class).newInstance(); DriverManager.registerDriver(driverName);
    conn = (Connection)DriverManager.getConnection(connect,"",""); }
    }catch (Exception e)
    }

    2). my environment is Linux 6.2, mysql version is 3.22.32, I dont install the Apache.
    3). When I run the program, I got the following wrong message:
    AppAccelerator(tm) 1.2.010 for Java (JDK 1.2), x86 version.
    Copyright (c) 1997-1999 Inprise Corporation. All Rights Reserved.
    Class.forName(org.gjt.mm.mysql.Driver) ... DriverManager.registerDriver ... Driv
    erManaget.getConnection(jdbc:mysql://192.168.0.101:3306/test_db?user=mysql&passw
    ord=mysql) ...
    Error setting up DB Connection
    java.sql.SQLException: Invalid authorization specification: Access denied for us
    er: 'mysql@' (Using password: YES)
    at org.gjt.mm.mysql.MysqlIO.init(Compiled Code)
    at org.gjt.mm.mysql.Connection.<init>(Compiled Code)
    at org.gjt.mm.mysql.Driver.connect(Compiled Code)
    at java.sql.DriverManager.getConnection(DriverManager.java:457)
    at java.sql.DriverManager.getConnection(DriverManager.java:137)
    at DataAccess.<init>(DataAccess.java:25)
    at Test.main(Test.java:23)

    4). however, when I debug it, the system give me another problem:
    java.net.SocketException: Connection reset by peer: JVM_recv in socket input str
    eam read
    at java.net.SocketInputStream.socketRead(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:90)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:190)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:208)
    at java.io.DataInputStream.readByte(DataInputStream.java:224)
    at org.gjt.mm.mysql.MysqlIO.readPacket(MysqlIO.java:795)
    at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:261)
    at org.gjt.mm.mysql.Connection.<init>(Connection.java:230)
    at org.gjt.mm.mysql.Driver.connect(Driver.java:126)
    at java.sql.DriverManager.getConnection(DriverManager.java:457)
    at java.sql.DriverManager.getConnection(DriverManager.java:137)
    at DataAccess.<init>(DataAccess.java:25)
    at Test.main(Test.java:23)
    Error setting up DB Connection
    java.sql.SQLException: Communication link failure: java.net.SocketException
    at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:319)
    at org.gjt.mm.mysql.Connection.<init>(Connection.java:230)
    at org.gjt.mm.mysql.Driver.connect(Driver.java:126)
    at java.sql.DriverManager.getConnection(DriverManager.java:457)
    at java.sql.DriverManager.getConnection(DriverManager.java:137)
    at DataAccess.<init>(DataAccess.java:25)
    at Test.main(Test.java:23)

    Thank for any advice.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    SLC, UT, USA
    Posts
    47
    Rep Power
    16
    You said:

    "Hi, guys:
    I am trying to connect Mysql with jdbc. however, I got the problem as following,
    1). The following is my source code of java:
    public DataAccess(String connect) {
    connect = "jdbc:mysql://192.168.0.101:3306/test_db?user=mysql&password=mysql";
    String driver_class = new String("org.gjt.mm.mysql.Driver");
    try {
    if (conn == null) {
    Driver riverName = (driver) Class.forName(driver_class).newInstance(); "

    If you block copied this directly then perhaps it's a typo. In the last line above it looks like you've used "riverName" instead of "driverName".

    Robman

Similar Threads

  1. Lost connection to MySQL server during query
    By bcraft in forum MySQL Help
    Replies: 1
    Last Post: December 9th, 2003, 08:58 AM
  2. Replies: 1
    Last Post: December 6th, 2003, 08:26 PM
  3. MySQL Remote connection using PHP
    By Smo in forum PHP Development
    Replies: 5
    Last Post: November 27th, 2003, 02:02 AM
  4. MySQL Connection
    By Zitan in forum MySQL Help
    Replies: 2
    Last Post: August 25th, 2001, 08:14 PM
  5. JDBC connection with MySQL
    By svc in forum MySQL Help
    Replies: 0
    Last Post: October 14th, 1999, 01:19 PM

IMN logo majestic logo threadwatch logo seochat tools logo