可能是木那个字段 例如:
select a.name,b.ds from tab a,tab b
select a.name,b.ds from tab a,tab b
解决方案 »
- JTextField JPasswordField添加图标问题
- 求正则表达式阿
- MyEclipse路径问题续
- MyEclipse+weblogic+xfire开发webservice,返回的二进制数据(byte[])无法调用
- Spring注入时会有下面的警告 是什么意思?
- 一个简单的依赖注入问题有this field **never locally 提示
- 求救!!!各位学长请帮帮我,hibernate 问题
- 求一段JSP可以执行的图片缩小代码!谢谢!急~~
- 非常弱的问一句Eclipse 3.1.2出来了,相应的汉化包也出来了吗?
- bootstrap大神看过来 求助
- 用table控制页面布局的问题
- Struts的高手给指点一下
package com.qiu.jdbc;
import java.net.*;
import java.sql.*;public class select { /**
* @param args
*/
public static void main(String[] args) {
String l="jdbc:odbc:test";
try{
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e){
System.out.println("ClassNotFountException: ");
System.err.println(e.getMessage());
}
Connection con=DriverManager.getConnection(l,"sa","");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from USER1 ");
while(rs.next()){
for(int i=0;i<=3;i++)
System.out.println("这是第"+i+"个字符的内容"+rs.getString(i));
}
con.close();
}
catch(SQLException e){
while(e!=null){
System.out.println("数据库异常被捕获");
System.out.println(e.getMessage());
System.out.println(e.getErrorCode());
e=e.getNextException();
}
}
}
}
package com.qiu.jdbc;
import java.net.URL;
import java.sql.*;public class test { /**
* @param args
*/
public static void main(String[] args) {
String l="jdbc:odbc:test";
try{
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(java.lang.ClassNotFoundException e){
System.out.print("ClassNotFoundException:");
System.err.print(e.getMessage());
}
Connection con=DriverManager.getConnection(l,"sa"," ");
DatabaseMetaData dma=con.getMetaData();
System.out.println("连接的数据库:"+dma.getURL());
System.out.println("Driver :"+dma.getDriverName());
System.out.println("Vension :"+dma.getDriverVersion());
con.close();
}
catch(SQLException e){
while(e!=null){
System.out.println("数据库异常被捕获了");
System.out.println(e.getSQLState());
System.out.println(e.getMessage());
System.out.println(e.getErrorCode());
e=e.getNextException();
}
}
}
}
问下 用sqlserver2000 是不是一定要装补丁sp3的
Connection con=DriverManager.getConnection(l,"sa"," ");
The password is empty or one space?2. You may need a database name before USER1, sth. like [MEMBER].[SA].USER1.
Or you should add the database name in your connection url.