new password will not be effective for connection immediately

2006-04-04 Thread NanFei Wang
Hi,
I want to change the password of the User( which is root) in the table 'user' 
from the database 'mysql'.

I use the String sql = update user set Password=password('somePassWord') where 
User='root';
I see from MySql Query Browser the password really changed !

Before I stop the mysql from Service in Control Panel of my machine Window Xp,
I can still make connection to the mysql database with the old password of the 
user 'root'.

Only when I Stop and Start again the mysql from Service in Control Panel ,
the connection to the mysql database with the old password of the user 'root' 
will fail,
and with the new password of the user 'root' will succeed !

My question is I hope the new password will be effective for connection 
immediately
without ' Stop and Start ' the mysql Service.

Thanks for your help !

NanFei


java.net.BindException: Address already in use: JVM_Bind

2006-03-07 Thread NanFei Wang
Dear all:

I use Tomcat 5.5.9 and Mysql Server 5.0 (with the driver 
mysql-connector-java-3.1.12-bin.jar)

 to run my Application on Windows XP.

It run smoothly many times throughout the whole Application without any problem 
!

But in an unexpected time, I get the following Error messages.

I can only ' Stop ' Tomcat 5.5.9 and ' Start ' it again, Then it will be Ok to 
run my Application.

Can you tell me how to solve the problem ?

by  NanFei

javax.servlet.ServletException: Communications link failure due to underlying 
exception: 

** BEGIN NESTED EXCEPTION ** 

java.net.SocketException
MESSAGE: java.net.BindException: Address already in use: JVM_Bind

STACKTRACE:

java.net.SocketException: java.net.BindException: Address already in use: 
JVM_Bind
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
at com.mysql.jdbc.MysqlIO.init(MysqlIO.java:284)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2555)
at com.mysql.jdbc.Connection.init(Connection.java:1485)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at upload.mysqlConn.init(mysqlConn.java:39)
at upload.mysqlConn.init(mysqlConn.java:19)
at org.apache.jsp.queryChoice_jsp._jspService(org.apache.jsp.queryChoice_jsp:67)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValvejava:213)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValvejava:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)


** END NESTED EXCEPTION **



Stored Procedure in mysql 5.0 failure!

2004-04-06 Thread NanFei Wang
Hi,
somebody can help me!

my database is: mysql-5.0.0a-alpha
the connection driver is:mysql-connector-java-3.1.1-alpha-bin.jar

I want to test stored procedure of the new feature in MySQL version 5.0. A 

I can call the stored procedure procPara in Window Console as next show,
but when I run in procTest.java,I get error Messages.
The error is at the line:
 CallableStatement cs=conn.prepareCall({call procPara(?)});
 between checkpoint 1 and checkpoint 2

your answer is highly appreciated!
from: NanFei
-

mysql delimiter //
mysql
mysql CREATE PROCEDURE procPara(IN name varchar(16))
-  BEGIN
-SELECT note FROM kmdoc where username=name;
-  END
-  //
Query OK, 0 rows affected (0.22 sec)

mysql call procPara(John)//
+--+
 | note |
+--+
 | mysql Manul   |
 | Office2000  |
 | PDF|
 | PowerPoint Animation Runtime   |
 | Office2003  |
 | Test Title|
 | Say Hello   |
+-+
7 rows in set (1.16 sec)

Query OK, 0 rows affected (1.67 sec)

mysql

--
procTest.java  as following:

package km;
import java.sql.*;

public class procTest{
  public static void main(String[] args)throws Exception {
String driverConnection=jdbc:mysql://localhost/;
String catalog=mycatloge;
String user=myname;
String psw=mypsw;
String connDbUserPsw=driverConnection+catalog+
   ? user=+user+password=+psw;
try {
  Class.forName(com.mysql.jdbc.Driver);
}
catch (ClassNotFoundException e) {}
Connection conn = DriverManager.getConnection(connDbUserPsw);
System.out.println(checkpoint 1);
CallableStatement cs=conn.prepareCall({call procPara(?)});
System.out.println(checkpoint 2);
cs.setString(1,john);
java.sql.ResultSet rst=cs.executeQuery();
while(rst.next()){
  String s=rst.getString(1);
  System.out.println(s);
}
  }
}


Messages:

checkpoint 1
java.lang.StringIndexOutOfBoundsException: String index out of range: -9
 at java.lang.String.substring(String.java:1480)
 at com.mysql.jdbc.DatabaseMetaData$TypeDescriptor.init(DatabaseMetaData.java:7031)
 at 
com.mysql.jdbc.DatabaseMetaData.getCallStmtParameterTypes(DatabaseMetaData.java:6615)
 at com.mysql.jdbc.DatabaseMetaData.getProcedureColumns(DatabaseMetaData.java:2637)
 at 
com.mysql.jdbc.CallableStatement.determineParameterTypes(CallableStatement.java:904)
 at com.mysql.jdbc.CallableStatement.init(CallableStatement.java:72)
 at com.mysql.jdbc.Connection.prepareCall(Connection.java:999)
 at com.mysql.jdbc.Connection.prepareCall(Connection.java:978)
 at km.procTest.main(procTest.java:17)
Exception in thread main 

-