Re: My JDBC does not work.

2002-03-15 Thread Ken Anderson



Jianping Zhu wrote:

> Invalid authorization specification: Access denied for user:
> 'jianping@chambleea' (Using password: YES)

> I am just wondering, I do have a account 'jianping' which have all
> privilege in global level.

All priv at all hosts, including localhost or localhost.localdomain
(sometimes required on redhat)??
Check first column of mysql.user table.
Ken

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: My JDBC does not work.

2002-03-15 Thread Linux Rules

On Fri, 15 Mar 2002, Jianping Zhu wrote:

>
> I have spend three days try to get jdbc for mysql work, but failed. I am
> very frustrated. I will
> be appreciated if somebody can help me out.
>
> I have redhat 7.2 OS, I download the sever and client mysql .rpm files and
> instaled it, i believe succssfully. i use command like 'mysqladmin
> version' to test the mysql server, the server seems work fine, I have a
> mysql user account 'jianping' which has been granted all global privilges.
>
> I downloaded  the JDBC mm.mysql-2.0.4-bin.jar to my system and set the env
> varible properly.
>
> I have a database called 'evote' and there is one table 'stocks' in the
> database.
> I use the code download form a jDBc tutrial website the code is:
>
> 
> import java.sql.*;
> import java.io.*;
> import java.util.*;
>
> class StocksMy {
>public static void main (String args []) {
>
>   try {
>
>  Class.forName("org.gjt.mm.mysql.Driver").newInstance();
>   System.out.println("");
>
>  // Create a Connection and a Statement
>  Connection conn = DriverManager.getConnection(
>
> "jdbc:mysql://localhost/evote?user=jianping&password=ping1830");
>   System.out.println("33");
>  Statement stmt = conn.createStatement();
>  // Select all columns from the STOCKS table
>  ResultSet rset = stmt.executeQuery ("select * from stocks");
>
>  // Iterate through the result and print the records
>  while (rset.next()) {
> String ticker=rset.getString(1).trim();
> String title=rset.getString(2).trim();
> String price=rset.getString(3).trim();
> String blanks=
> "  ";
> // print the data in a table format
> System.out.print (ticker);
> System.out.print(blanks.substring(1,8-ticker.length()));
> System.out.print (title);
> System.out.print(blanks.substring(1,41-title.length()));
> System.out.println (price);
>  }
>   } catch (Exception e) {
>  System.out.println("StocksMy: JDBC exception");
>  System.exit(1);
>   }
>}
> }
> 
> I added some System.out.println () trying to the code.
>
> The code can be compiled succesfully, but when i tried to execute it, it
> gave  folliing output.
>
> 1
> Stocksmy: JDBC exception
>
> because it did not print 333 so I believe the problem is that
> the connection can not be establish.
>
> Thanks in advance.
>
>
>
> ___
> Redhat-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/redhat-list
>



Why don't you print the error ??

tr{
blablabla

}catch ( Exception X ){
System.out.println ( X.getMessage() );
}

this way your java program will tell you what's the problemo


Seguimos ...

leonel;



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: My JDBC does not work.

2002-03-15 Thread Jianping Zhu


Thanks for your advices.
After I modified my code according to your advice i get following error
message.

Invalid authorization specification: Access denied for user: 
'jianping@chambleea' (Using password: YES)
java.sql.SQLException: Invalid authorization specification: Access denied 
for user: 'jianping@chambleea' (Using password: YES)
at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:330)
at org.gjt.mm.mysql.Connection.connectionInit(Connection.java:261)
at 
org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Connection.java:89)
at org.gjt.mm.mysql.Driver.connect(Driver.java:167)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:199)
at StocksMy.main(StocksMy.java:66)


I am just wondering, I do have a account 'jianping' which have all
privilege in global level.

I will be appreciated for any further advice.

 



On Fri, 15 Mar 2002, Diego, Emil wrote:

> 
> Try using a URL in the following format
> 
> m_dbURL = "jdbc:mysql://" + m_dbServer + "/" + m_dbName;
> 
> and then use the following statement to connect.
> 
> m_dbConn  = DriverManager.getConnection(m_dbURL, m_dbUID, m_dbPWD);
> 
> 
> 
> Also add the following statement to your SQL Exception to get a more
> meaningfull error message
> 
> System.out.println(e.getMessage());
> 
> Try this and post the error message you are getting, that should give us a
> better idea of what is going wrong with the connection attempt.
> 
> 
> Emil Diego
> Web Coordinator
> University of Miami School of Business
> [EMAIL PROTECTED]
> ph: 305.284.5449
> fx: 305.284.3404
> 
> 
> 
> -Original Message-
> From: Jianping Zhu [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 15, 2002 11:22 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: My JDBC does not work.
> 
> 
> 
> I have spend three days try to get jdbc for mysql work, but failed. I am
> very frustrated. I will
> be appreciated if somebody can help me out.
> 
> I have redhat 7.2 OS, I download the sever and client mysql .rpm files and
> instaled it, i believe succssfully. i use command like 'mysqladmin
> version' to test the mysql server, the server seems work fine, I have a
> mysql user account 'jianping' which has been granted all global privilges. 
> 
> I downloaded  the JDBC mm.mysql-2.0.4-bin.jar to my system and set the env
> varible properly.
> 
> I have a database called 'evote' and there is one table 'stocks' in the
> database.
> I use the code download form a jDBc tutrial website the code is:   
>   
> 
> import java.sql.*;
> import java.io.*;
> import java.util.*;
> 
> class StocksMy {
>public static void main (String args []) {
> 
>   try {
> 
>  Class.forName("org.gjt.mm.mysql.Driver").newInstance();
>   System.out.println("");
> 
>  // Create a Connection and a Statement
>  Connection conn = DriverManager.getConnection(
> 
> "jdbc:mysql://localhost/evote?user=jianping&password=ping1830");
>   System.out.println("33");
>  Statement stmt = conn.createStatement();
>  // Select all columns from the STOCKS table
>  ResultSet rset = stmt.executeQuery ("select * from stocks");
> 
>  // Iterate through the result and print the records
>  while (rset.next()) {
> String ticker=rset.getString(1).trim();
> String title=rset.getString(2).trim();
> String price=rset.getString(3).trim();
> String blanks=
> "  ";
> // print the data in a table format
> System.out.print (ticker);
> System.out.print(blanks.substring(1,8-ticker.length()));
> System.out.print (title);
> System.out.print(blanks.substring(1,41-title.length()));
> System.out.println (price);
>  }
>   } catch (Exception e) {
>  System.out.println("StocksMy: JDBC exception");
>  System.exit(1);
>   }
>}
> }
> 
> I added some System.out.println () trying to the code.
> 
> The code can be compiled succesfully, but when i tried to execute it, it
> gave  folliing output.
> 
> 1
> Stocksmy: JDBC exception
> 
> because it did not print 333 so I believe the problem is that
> the connection can not be establish.
> 
> Thanks in advance.
> 
> 
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 


Re: My JDBC does not work.

2002-03-15 Thread TAKAHASHI, Tomohiro
  Hi,

Jianping Zhu wrote:
> 
> I have spend three days try to get jdbc for mysql work, but failed. I am
> very frustrated. I will
> be appreciated if somebody can help me out.
snip
>   } catch (Exception e) {
>  System.out.println("StocksMy: JDBC exception");
>  System.exit(1);
>   }
>}
> }

  Please print Exception as below and check RDBMS configuration.

} catch (Exception e) {
   System.out.println(e.getMessage());
   e.printStackTrace();
   System.exit(1);
}

-- 
TAKAHASHI, Tomohiro

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php