各位高手帮帮眼 应该是你的代码有问题到Tomcat\work\Standalone\localhost找你的reading_jsp.java看看93行 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可是其他有数据库操作的页面错误提示都是一样的,没有数据库操作的就能正常显示啊而且Tomcat5.0窗口都是显示下面一行提示:java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.我真不知怎么弄啊 我把我的数据库连接发上来,大家再看看,谢谢//DBConnectionBean.java//用在jsp网页里的数据库桥接beanpackage examinline;import java.util.*;import java.sql.*;import java.io.*;public class DBConnectionBean{ Connection dbcon=null; Statement stmt=null; ResultSet result=null; String driver=""; String url=""; String user=""; String password=""; public DBConnectionBean(){ try{ InputStream fis =getClass().getResourceAsStream("jdbcsql.properties"); Properties ps=new Properties(); ps.load(fis); driver=ps.getProperty("driver"); url=ps.getProperty("url"); user=ps.getProperty("username"); password=ps.getProperty("password"); Class.forName(this.driver); } catch(Exception e){ System.out.println(e); } } public void setdrivername() { try{ Class.forName(this.driver); System.out.println("加载数据驱动成功!"); }catch(ClassNotFoundException e){ System.out.println("jdbc driver error"); } } public Connection getopenConnection(){ try{ this.dbcon=DriverManager.getConnection(this.url,this.user,this.password); System.out.println("桥接数据库成功!"); }catch(SQLException e2){ System.out.println(e2); } return dbcon; } public ResultSet executeQuery(String query)throws SQLException{ this.stmt=dbcon.createStatement(); this.result=stmt.executeQuery(query); return result; } public void executeUpdate(String query)throws SQLException{ this.stmt=dbcon.createStatement(); stmt.executeUpdate(query); if(stmt!=null) stmt.close(); } public String getData(int index) throws SQLException{ return result.getString(index); } public int getIntData(int index) throws SQLException{ return result.getInt(index); } public float getFltData(int index) throws SQLException{ return result.getFloat(index); } public boolean next() throws SQLException{ return result.next(); } public void resetResult() throws SQLException{ this.result=null; } public void close() throws SQLException{ if(dbcon!=null) dbcon.close(); if(stmt!=null) stmt.close(); if(result!=null) result.close(); } public void finalize() throws Throwable{ this.close(); } public String replaceString(String str){ char tempArray[]=str.toCharArray(); int iCurr[]=new int[10]; int j=0; for(int i=0;i!=tempArray.length;i++) { int temp=(int)tempArray[i]; if(temp==92){ iCurr[j]=i; j++; } } final int temp2=j+1; String strArray[]=new String[temp2]; strArray[0]=str.substring(0,iCurr[0]); strArray[temp2-1]=str.substring(iCurr[j-1]+1); for(int m=1;m!=strArray.length-1;m++){ strArray[m]=str.substring(iCurr[m-1]+1,iCurr[m]); } str=""; for(int k=0;k!=strArray.length-1;k++){ str=str+strArray[k]+"%5C"; } str=str+strArray[temp2-1]; return str; }}配置文件为driver=com.microsoft.jdbc.sqlserver.SQLServerDriverurl=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=examusername=sapassword=751020帮忙看下哪有问题没有 谁能给我一个完整的JSP上传图片的例子。。 java实现远程开关机 ajax 连续使用两个responseText返回数据出错,前一个responseText返回数据丢失 做简单struts项目遇到的问题 jsp文件中引入txt文件的中文转换问题 请问关于网络方面的书哪本最为权威?请求指点。 JSP中怎么在写数据库记录时锁定记录不允许修改? 请教:在有 <jsp:include page="xx.jsp"/> 的页面中 POST 和 GET 的不同! 再问rainshow 求助struts2中s:select list从action取值问题 请教如何读取ie“后退”页地址 框架传值问题!
而且Tomcat5.0窗口都是显示下面一行提示:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
我真不知怎么弄啊
//DBConnectionBean.java
//用在jsp网页里的数据库桥接bean
package examinline;
import java.util.*;
import java.sql.*;
import java.io.*;public class DBConnectionBean{
Connection dbcon=null;
Statement stmt=null;
ResultSet result=null;
String driver="";
String url="";
String user="";
String password=""; public DBConnectionBean(){
try{
InputStream fis =getClass().getResourceAsStream("jdbcsql.properties");
Properties ps=new Properties();
ps.load(fis);
driver=ps.getProperty("driver");
url=ps.getProperty("url");
user=ps.getProperty("username");
password=ps.getProperty("password");
Class.forName(this.driver);
}
catch(Exception e){
System.out.println(e);
}
}
public void setdrivername()
{
try{
Class.forName(this.driver);
System.out.println("加载数据驱动成功!");
}catch(ClassNotFoundException e){
System.out.println("jdbc driver error");
}
}
public Connection getopenConnection(){ try{
this.dbcon=DriverManager.getConnection(this.url,this.user,this.password);
System.out.println("桥接数据库成功!");
}catch(SQLException e2){
System.out.println(e2);
}
return dbcon;
}
public ResultSet executeQuery(String query)throws SQLException{
this.stmt=dbcon.createStatement();
this.result=stmt.executeQuery(query);
return result;
} public void executeUpdate(String query)throws SQLException{
this.stmt=dbcon.createStatement();
stmt.executeUpdate(query);
if(stmt!=null) stmt.close();
}
public String getData(int index) throws SQLException{
return result.getString(index);
}
public int getIntData(int index) throws SQLException{
return result.getInt(index);
}
public float getFltData(int index) throws SQLException{
return result.getFloat(index);
}
public boolean next() throws SQLException{
return result.next();
}
public void resetResult() throws SQLException{
this.result=null;
}
public void close() throws SQLException{
if(dbcon!=null) dbcon.close();
if(stmt!=null) stmt.close();
if(result!=null) result.close();
}
public void finalize() throws Throwable{
this.close();
}
public String replaceString(String str){ char tempArray[]=str.toCharArray(); int iCurr[]=new int[10]; int j=0; for(int i=0;i!=tempArray.length;i++)
{
int temp=(int)tempArray[i];
if(temp==92){
iCurr[j]=i;
j++; }
} final int temp2=j+1; String strArray[]=new String[temp2];
strArray[0]=str.substring(0,iCurr[0]);
strArray[temp2-1]=str.substring(iCurr[j-1]+1); for(int m=1;m!=strArray.length-1;m++){
strArray[m]=str.substring(iCurr[m-1]+1,iCurr[m]);
}
str="";
for(int k=0;k!=strArray.length-1;k++){
str=str+strArray[k]+"%5C";
}
str=str+strArray[temp2-1];
return str;
}}
配置文件为
driver=com.microsoft.jdbc.sqlserver.SQLServerDriver
url=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=exam
username=sa
password=751020
帮忙看下哪有问题没有