Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
to work with database...
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Bumsys, post: 3571708"] I want to write file to database sybase. I run the following code: public class TestSybase { public static void main( String[] args ) { try { // Connect to the database Class.forName("com.sybase.jdbc3.jdbc.SybDriver"); String url = "jdbc:sybase:Tds:10.64.3.27:5000/au12"; Connection con = DriverManager.getConnection(url, "sa", ""); // Execute the SQL statement Statement stmt = con.createStatement(); String query = "insert into au_log (logfile) values (?)"; PreparedStatement ps = con.prepareStatement(query); File file = new File("C:\\Temp\\tttt.rar"); int len = (int) file.length(); if (!file.exists()) { ps.setNull(1, Types.LONGVARBINARY); } else if (file.exists() && len == 0) { ps.setNull(1, Types.LONGVARBINARY); } else { InputStream in = new FileInputStream(file); ps.setBinaryStream(1, in, len); } int numberOfRows = ps.executeUpdate(); System.out.println("rows: " + numberOfRows); ps.close(); stmt.close(); } catch( Exception e ) { System.out.println(e.getMessage()); e.printStackTrace(); } } } If I write a small file to database sybase all is ok. But if a big file I have error: com.sybase.jdbc3.jdbc.SybSQLException: There is not enough procedure cache to run this procedure, trigger, or SQL batch. Retry later, or ask your SA to reconfigure ASE with more procedure cache. There is not enough procedure cache to run this procedure, trigger, or SQL batch. Retry later, or ask your SA to reconfigure ASE with more procedure cache. at com.sybase.jdbc3.tds.Tds.a(Unknown Source) at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.updateLoop(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.executeUpdate(Unknown Source) at com.sybase.jdbc3.jdbc.SybPreparedStatement.executeUpdate(Unknown Source) at test.TestSybase.main(TestSybase.java:96) I change procedure cache but I have this error again. What can do that write a big file to sybase? [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
to work with database...
Top