Class.forName("sun.jdbc.odbc.jdbcobcDriver");
请加入引号
请加入引号
解决方案 »
- 问大家一个关于业务逻辑层的问题,谢谢。
- 关于多行提交的问题
- HttpServletRequest已经没有getLocalAddr方法,如何处理?
- 急的问题,有关jsp的网站动态读来的数据要求滚动问题!
- jsp中的重定向问题??
- 请教这段代码含义
- 在jsp爷里要做一个四级连动的菜单,怎么做效率高?
- 把jsp文件,改为javabean再在jsp中调用bean,可是这个jsp怎么改正好呢?这个jsp已经测试通过的。谢谢
- HttpServletRequest显示汉字出错,求教
- 关于上传图片问题 求大神解决 在线等
- !!!测试了一天了还没有找到原因!请求大虾指点迷津!一个与List有关的问题!!!解决马上给分!!!
- 请教高手,回答必给分
加了引号也没有成呀,到这里就出错
Connection c=DriverManager.getConnection(con.dburl,con.username,con.password);
不加引号,还到不出这些烂东西!
大小写,拼写!
* Created on 2003-4-15
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*//**
* @author Administrator
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
import java.sql.*;
class constr{
String dburl="jdbc:odbc:dzyls";
String username="sa";
String password="syncmaster";
}
public class democlass {
public static void main(String[] args){
constr con=new constr();
try{
Class.forName("sun.jdbc.odbc.JdbcObcDriver");
}
catch(ClassNotFoundException e)
{
System.out.println("ClassNotFoundException:" +e.getMessage());
}
Connection c=DriverManager.getConnection(con.dburl,con.username,con.password);
Statement s=c.createStatement();
ResultSet r=s.executeQuery("select * from gpzk");
while (r.next())
{
System.out.println(r.getString("pm"));
}
s.close();
} }
还是有问题,我纳闷,本人比较笨! 麻烦各位了!
String dburl="jdbc:odbc:dzyls";
String username="sa";
String password="syncmaster";
}
一个文件只能有一个类!!
你得把这个class放在文件外面或者放到类里面!
* Created on 2003-4-15
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*//**
* @author Administrator
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
import java.sql.*;
class constr{
String dburl="jdbc:odbc:dzyls";
String username="sa";
String password="syncmaster";
}
public class democlass {
public static void main(String[] args){
constr con=new constr();
Connection c = null;
Statement s = null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
c = DriverManager.getConnection(con.dburl,con.username,con.password);
s = c.createStatement();
ResultSet r=s.executeQuery("select * from gpzk");
while (r.next())
{
System.out.println(r.getString("pm"));
}
}
catch(Exception e){
System.out.println("ClassNotFoundException:" +e.getMessage());
}
finally{
try{
s.close();
c.close();
}catch(Exception e){}
}
} }