0

mysql problem!

asked 2006-03-26 09:16:51 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3651203

By: nobody

I have include the mysql-connector-java-3.1.12-bin.jar
I wrote the code in the <zscript></zscript> String sDBDriver="org.gjt.mm.mysql.Driver";
try{
Class.forName(sDBDriver);
}
catch(java.lang.ClassNotFoundException e){
System.out.println("Jdbc_conn():"+e.getMessage());
}

Connection
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","1234
5");
Statement stmt = conn.createStatement();
ResultSet res = stmt.executeQuery("select * from foo");

while (res.next())
{
String name = res.getString("name");
System.out.println(name);
}
res.close();

conn.close();

but, when i run it, I got the error:
java.sql.SQLException:No suitable driver[SQL:0,08001]

why? is the driver which i download from apache.com is not suitable for ZK?


delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2006-03-26 15:41:30 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3651450

By: nobody

ok, I have fixed it, but this time I put these code in a java file.
<button label="demo" onClick="save.onClick()">

and in the save.java:

public static void onClick() { ... }

it works fine.


link publish delete flag offensive edit

answered 2006-03-27 02:27:39 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3652001

By: tomyeh

Looks like it is a class-path issue. The class path used by BeanShell (ZK) seems to be different from DriverManager's.

Would you post the stack trace, what environment you are using, and where you put mysql's driver?

link publish delete flag offensive edit

answered 2006-03-30 06:40:30 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3659133

By: tomyeh

To open a MySQL connection with zscript, you have to put mysql-connector*.jar under the same directory with zk.jar.

For example, you put them both under shared/lib, or both under WEB-INF/lib.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2006-03-26 09:16:51 +0800

Seen: 577 times

Last updated: Mar 30 '06

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More