-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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?
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.
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?
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.
Asked: 2006-03-26 09:16:51 +0800
Seen: 577 times
Last updated: Mar 30 '06