[求助]JAVA连Sybase数据库报这个错,帮忙看看
<p>import java.sql.*;</p><p>public class SampleCode {<br/> public static void main(String args[]) {<br/> try {<br/> /*<br/> * Open the connection. May throw a SQLException.<br/> */<br/> DriverManager.registerDriver((Driver) Class.forName(<br/> "com.sybase.jdbc3.jdbc.SybDriver").newInstance());<br/> Connection con = DriverManager.getConnection(<br/> "jdbc:sybase:Tds:STUDIO:5000", "sa", "11111111");<br/> /*<br/> * Create a statement object, the container for the SQL statement.<br/> * May throw a SQLException.<br/> */<br/> Statement stmt = con.createStatement();<br/> /*<br/> * Create a result set object by executing the query. May throw a<br/> * SQLException.<br/> */<br/> ResultSet rs = stmt.executeQuery("Select * from client");<br/> /*<br/> * Process the result set.<br/> */<br/> if (rs.next()) {<br/> //int value = rs.getInt(1);<br/> String name = rs.getString("user_name");<br/> System.out.println("user_name " + name);<br/> //System.out.println("Fetched value " + value);<br/> }<br/> rs.close();<br/> stmt.close();<br/> con.close();<br/> }// end try<br/> /*<br/> * Exception handling.<br/> */</p><p> catch (SQLException sqe) {<br/> System.out.println("Unexpected exception : " + sqe.toString()<br/> + ", sqlstate = " + sqe.getSQLState());<br/> System.exit(1);<br/> }// end catch????<br/> catch (Exception e) {<br/> e.printStackTrace();<br/> System.exit(1);<br/> }// end catch<br/> System.exit(0);<br/> }<br/>}<br/></p><p>报这个错,怎么处理呢?连了这么多种数据库,只有这一个没连上的!</p><p>Unexpected exception : com.sybase.jdbc3.jdbc.SybSQLException: client not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).<br/>, sqlstate = 42000</p> <p>Connection con = DriverManager.getConnection(<br/> "jdbc:sybase:Tds:localhost:5000", "sa", "11111111");</p><p></p><p>改成这样又出这个错</p><p>Unexpected exception : java.sql.SQLException: JZ006: 捕获到 IO 例外:java.net.ConnectException: Connection refused: connect, sqlstate = JZ006</p> <p>Unexpected exception : com.sybase.jdbc3.jdbc.SybSQLException: clientnot found. Specify owner.objectname or use sp_help to check whether the
object exists (sp_help may produce lots of output).<br/>, sqlstate = 42000</p><br/><p><br/></p><p>翻译成中文,大意是:client这个对象(表或视图)不存在,希望楼上提问前先查查字典,懒一点的话,用金山词霸也可以.<br/></p>
页:
[1]