两个不同的数据库服务器,有一台连接不上,急!!! 用同一个应用程序连接WINDOWS数据库正常,但是连接solaris数据库失败,两个库结构相同。solaris监听没问题。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 都是oracle数据库.连接windows服务器正常,但连接solaris服务器异常,在客户端用SQLPLUS可以连上java.sql.SQLException: Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4)))) Oracle错误号 12505 连接不上数据库Listener Listener有没有启动, 数据库端口号有没有配置正确? private void transPHOTO(String cond){ String url_source = "jdbc:oracle:thin:@10.106.184.200:1521:pcsdb"; String user_source = "ipos_cc"; String pass_source = "sysmanager"; String url_target = "jdbc:oracle:thin:@10.106.184.200:1521:pcsdb"; String user_target = "ipos_cc"; String pass_target = "sysmanager"; int size = 1000; int count = 0; String width = "120"; String height = "150"; Connection conn_source=null; Connection conn_target=null; Statement stmt_source = null; ResultSet rs_source = null; PreparedStatement ps_target = null; ResultSet rs_target = null; BLOB zp = null; byte[] data = new byte[1024 * 64]; long star = System.currentTimeMillis(); String sql_selzp = " select * from v_rkzp where zpbh like '" + cond + "%' order by zpbh"; String sql_inert = " insert into t_rkzpb(zpbh,rybh,zp,cjsj,width,height) "+ " values(?,?,empty_blob(),?,?,?)"; try{ Class.forName(SystemConstant.DB_DRIVER); conn_source = DriverManager.getConnection(url_source,user_source,pass_source); conn_source.setAutoCommit(false); conn_target = DriverManager.getConnection(url_target,user_target,pass_target); conn_target.setAutoCommit(false); stmt_source = conn_source.createStatement(); rs_source = stmt_source.executeQuery(sql_selzp); rs_source.setFetchSize(2000); while(rs_source.next()){ data = rs_source.getBytes("zp"); String str_zpbh = "2201" + rs_source.getString("zpbh"); String str_rybh = "2201" + rs_source.getString("rybh"); String str_cjsj = rs_source.getString("smsj"); ps_target = conn_target.prepareStatement(sql_inert); ps_target.setString(1,str_zpbh); ps_target.setString(2,str_rybh); ps_target.setString(3,str_cjsj); ps_target.setString(4,width); ps_target.setString(5,height); ps_target.execute(); ps_target.close(); String sql_select = " select zp from t_rkzpb where zpbh ='" + str_zpbh + "' for update"; //String sql_update = " update t_rkzpb set zp = ? where zpbh='" + str_zpbh + "'"; ps_target = conn_target.prepareStatement(sql_select); rs_target = ps_target.executeQuery(); if(rs_target.next()){ zp = (BLOB)rs_target.getBlob(1); BufferedOutputStream out = new BufferedOutputStream(zp.getBinaryOutputStream()); out.write(data,0,data.length); out.close(); } rs_target.close(); ps_target.close(); //conn_target.commit(); /*ps_target = conn_target.prepareStatement(sql_update); ps_target.setBlob(1,zp); ps_target.executeUpdate(); ps_target.close();*/ if(++count % size == 0){ conn_target.commit(); long stop = System.currentTimeMillis(); float second = (stop - star) / 1000; System.out.println(count + " 条照片用时:" + second + " 秒!"); } } conn_target.commit(); rs_target.close(); ps_target.close(); conn_source.close(); conn_target.close(); } catch(SQLException sqlex){ sqlex.printStackTrace(); try{ if(rs_target != null) rs_target.close(); if(ps_target != null) ps_target.close(); if(rs_source != null) rs_source.close(); if(stmt_source != null) stmt_source.close(); } catch(SQLException sex){ System.out.println("Exception -----2"); } } catch(IOException ioex){ System.out.println("Exception -----3"); ioex.printStackTrace(); } catch(Exception ex){ } finally{ zp = null; data = null; }} 上面的代码连其他数据库正常, Listener也启动了,端口号也对,但就是连不上呢? 求树状菜单,带数据库和复选框的那种? 晕啊,简单的Struts的配置不会了。大家过来看看问题出在了哪里! 方正集团何如 那为大哥有SQL的驱动程序 简单问题!散分了!散分了!散分了!散分了! 这种错误如何改?Column not found 急!!!在线等! 数据查询问题,谢谢捧场。 B/S模式下如何打印报表? 制作一个大型页面之前的装载页面的原理是什么? 在Eclipse里.java文件会自动编译吗,各位前辈指导下 这个如何在jsp使用 在网页上添加一个导出Excel文件按钮,代码如何实现,请指点一下。
java.sql.SQLException: Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
Listener有没有启动, 数据库端口号有没有配置正确?
String user_source = "ipos_cc";
String pass_source = "sysmanager"; String url_target = "jdbc:oracle:thin:@10.106.184.200:1521:pcsdb";
String user_target = "ipos_cc";
String pass_target = "sysmanager"; int size = 1000;
int count = 0; String width = "120";
String height = "150"; Connection conn_source=null;
Connection conn_target=null; Statement stmt_source = null;
ResultSet rs_source = null; PreparedStatement ps_target = null;
ResultSet rs_target = null; BLOB zp = null;
byte[] data = new byte[1024 * 64]; long star = System.currentTimeMillis(); String sql_selzp = " select * from v_rkzp where zpbh like '" +
cond + "%' order by zpbh"; String sql_inert = " insert into t_rkzpb(zpbh,rybh,zp,cjsj,width,height) "+
" values(?,?,empty_blob(),?,?,?)";
try{
Class.forName(SystemConstant.DB_DRIVER);
conn_source = DriverManager.getConnection(url_source,user_source,pass_source);
conn_source.setAutoCommit(false); conn_target = DriverManager.getConnection(url_target,user_target,pass_target);
conn_target.setAutoCommit(false); stmt_source = conn_source.createStatement();
rs_source = stmt_source.executeQuery(sql_selzp);
rs_source.setFetchSize(2000); while(rs_source.next()){
data = rs_source.getBytes("zp");
String str_zpbh = "2201" + rs_source.getString("zpbh");
String str_rybh = "2201" + rs_source.getString("rybh");
String str_cjsj = rs_source.getString("smsj"); ps_target = conn_target.prepareStatement(sql_inert);
ps_target.setString(1,str_zpbh);
ps_target.setString(2,str_rybh);
ps_target.setString(3,str_cjsj);
ps_target.setString(4,width);
ps_target.setString(5,height);
ps_target.execute();
ps_target.close(); String sql_select = " select zp from t_rkzpb where zpbh ='" + str_zpbh + "' for update";
//String sql_update = " update t_rkzpb set zp = ? where zpbh='" + str_zpbh + "'";
ps_target = conn_target.prepareStatement(sql_select);
rs_target = ps_target.executeQuery();
if(rs_target.next()){
zp = (BLOB)rs_target.getBlob(1);
BufferedOutputStream out = new BufferedOutputStream(zp.getBinaryOutputStream());
out.write(data,0,data.length);
out.close();
}
rs_target.close();
ps_target.close();
//conn_target.commit(); /*ps_target = conn_target.prepareStatement(sql_update);
ps_target.setBlob(1,zp);
ps_target.executeUpdate();
ps_target.close();*/
if(++count % size == 0){
conn_target.commit();
long stop = System.currentTimeMillis();
float second = (stop - star) / 1000;
System.out.println(count + " 条照片用时:" + second + " 秒!");
}
}
conn_target.commit();
rs_target.close();
ps_target.close();
conn_source.close();
conn_target.close();
}
catch(SQLException sqlex){
sqlex.printStackTrace();
try{
if(rs_target != null)
rs_target.close();
if(ps_target != null)
ps_target.close(); if(rs_source != null)
rs_source.close();
if(stmt_source != null)
stmt_source.close();
}
catch(SQLException sex){
System.out.println("Exception -----2");
}
}
catch(IOException ioex){
System.out.println("Exception -----3");
ioex.printStackTrace();
}
catch(Exception ex){ }
finally{
zp = null;
data = null;
}
}