hunter_z 发表于 2006-8-27 23:22:17

[求助]JAVA连Sybase数据库报这个错,帮忙看看

<p>import java.sql.*;</p><p>public class SampleCode {<br/>&nbsp;public static void main(String args[]) {<br/>&nbsp;&nbsp;try {<br/>&nbsp;&nbsp;&nbsp;/*<br/>&nbsp;&nbsp;&nbsp; * Open the connection. May throw a SQLException.<br/>&nbsp;&nbsp;&nbsp; */<br/>&nbsp;&nbsp;&nbsp;DriverManager.registerDriver((Driver) Class.forName(<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"com.sybase.jdbc3.jdbc.SybDriver").newInstance());<br/>&nbsp;&nbsp;&nbsp;Connection con = DriverManager.getConnection(<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"jdbc:sybase:Tds:STUDIO:5000", "sa", "11111111");<br/>&nbsp;&nbsp;&nbsp;/*<br/>&nbsp;&nbsp;&nbsp; * Create a statement object, the container for the SQL statement.<br/>&nbsp;&nbsp;&nbsp; * May throw a SQLException.<br/>&nbsp;&nbsp;&nbsp; */<br/>&nbsp;&nbsp;&nbsp;Statement stmt = con.createStatement();<br/>&nbsp;&nbsp;&nbsp;/*<br/>&nbsp;&nbsp;&nbsp; * Create a result set object by executing the query. May throw a<br/>&nbsp;&nbsp;&nbsp; * SQLException.<br/>&nbsp;&nbsp;&nbsp; */<br/>&nbsp;&nbsp;&nbsp;ResultSet rs = stmt.executeQuery("Select * from client");<br/>&nbsp;&nbsp;&nbsp;/*<br/>&nbsp;&nbsp;&nbsp; * Process the result set.<br/>&nbsp;&nbsp;&nbsp; */<br/>&nbsp;&nbsp;&nbsp;if (rs.next()) {<br/>&nbsp;&nbsp;&nbsp;&nbsp;//int value = rs.getInt(1);<br/>&nbsp;&nbsp;&nbsp;&nbsp;String name = rs.getString("user_name");<br/>&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("user_name " + name);<br/>&nbsp;&nbsp;&nbsp;&nbsp;//System.out.println("Fetched value " + value);<br/>&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;rs.close();<br/>&nbsp;&nbsp;&nbsp;stmt.close();<br/>&nbsp;&nbsp;&nbsp;con.close();<br/>&nbsp;&nbsp;}// end try<br/>&nbsp;&nbsp;/*<br/>&nbsp;&nbsp; * Exception handling.<br/>&nbsp;&nbsp; */</p><p>&nbsp;&nbsp;catch (SQLException sqe) {<br/>&nbsp;&nbsp;&nbsp;System.out.println("Unexpected exception : " + sqe.toString()<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ ", sqlstate = " + sqe.getSQLState());<br/>&nbsp;&nbsp;&nbsp;System.exit(1);<br/>&nbsp;&nbsp;}// end catch????<br/>&nbsp;&nbsp;catch (Exception e) {<br/>&nbsp;&nbsp;&nbsp;e.printStackTrace();<br/>&nbsp;&nbsp;&nbsp;System.exit(1);<br/>&nbsp;&nbsp;}// end catch<br/>&nbsp;&nbsp;System.exit(0);<br/>&nbsp;}<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>

hunter_z 发表于 2006-8-27 23:23:32

<p>Connection con = DriverManager.getConnection(<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"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>

flybean 发表于 2006-8-28 17:27:04

<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><br/><p><br/></p><p>翻译成中文,大意是:client这个对象(表或视图)不存在,希望楼上提问前先查查字典,懒一点的话,用金山词霸也可以.<br/></p>
页: [1]
查看完整版本: [求助]JAVA连Sybase数据库报这个错,帮忙看看

免责声明:
本站所发布的一切破解补丁、注册机和注册信息及软件的解密分析文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:Admin@SybaseBbs.com