|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > ask for help about JDBC connection with Mysql |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|