Search Results

Search found 6636 results on 266 pages for 'jdbc driver'.

Page 40/266 | < Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >

  • java.sql.SQLException: Operation not allowed after ResultSet closed

    - by javatraniee
    Why am I getting an Resultset already closed error? public class Server implements Runnable { private static int port = 1600, maxConnections = 0; public static Connection connnew = null; public static Connection connnew1 = null; public static Statement stnew, stnew1, stnew2, stnew3, stnew4; public void getConnection() { try { Class.forName("org.gjt.mm.mysql.Driver"); connnew = DriverManager.getConnection("jdbc:mysql://localhost/db_alldata", "root", "flashkit"); connnew1 = DriverManager.getConnection("jdbc:mysql://localhost/db_main", "root", "flashkit"); stnew = connnew.createStatement(); stnew1 = connnew.createStatement(); stnew2 = connnew1.createStatement(); stnew3 = connnew1.createStatement(); stnew4 = connnew1.createStatement(); } catch (Exception e) { System.out.print("Get Connection Exception---" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "----- > " + e); } } public void closeConnection() { try { if (!(connnew.isClosed())) { stnew.close(); stnew1.close(); connnew.close(); } if (!(connnew1.isClosed())) { stnew2.close(); stnew3.close(); stnew4.close(); connnew1.close(); } } catch (Exception e) { System.out.print("Close Connection Closing Exception-----" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "------->" + e); } } Server() { try { } catch (Exception ee) { System.out.print("Server Exceptions in main connection--" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "------>" + ee); } } public static void main(String[] args) throws SQLException { int i = 0; Server STUD = new Server(); STUD.getConnection(); try { ServerSocket listener = new ServerSocket(port); Socket server; while ((i++ < maxConnections) || (maxConnections == 0)) { @SuppressWarnings("unused") doComms connection; server = listener.accept(); try { ResultSet checkconnection = stnew4 .executeQuery("select count(*) from t_studentdetails"); if (checkconnection.next()) { // DO NOTHING IF EXCEPTION THEN CLOSE ALL CONNECTIONS AND OPEN NEW // CONNECTIONS } } catch (Exception e) { System.out.print("Db Connection Lost Closing And Re-Opning It--------" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "--------" + e); STUD.closeConnection(); STUD.getConnection(); } doComms conn_c = new doComms(server, stnew, stnew1, stnew2, stnew3); Thread t = new Thread(conn_c); t.start(); } } catch (IOException ioe) { System.out.println("Main IOException on socket listen: " + ioe); } } public void run() { } } class doComms implements Runnable { private Socket server; private String input; static Connection conn = null; static Connection conn1 = null; static Statement st, st1, st2, st3; doComms(Socket server, Statement st, Statement st1, Statement st2, Statement st3) { this.server = server; doComms.st = st; doComms.st1 = st1; doComms.st2 = st2; doComms.st3 = st3; } @SuppressWarnings("deprecation") public void run() { input = ""; // char ch; try { DataInputStream in = new DataInputStream(server.getInputStream()); OutputStreamWriter outgoing = new OutputStreamWriter(server.getOutputStream()); while (!(null == (input = in.readLine()))) { savetodatabase(input, server.getPort(), outgoing); } } catch (IOException ioe) { System.out.println("RUN IOException on socket listen:-------" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "----- " + ioe); ioe.printStackTrace(); } } public void savetodatabase(String line, int port1, OutputStreamWriter outgoing) { try { String Rollno = "-", name = "-", div = "-", storeddate = "-", storedtime = "-", mailfrom = ""; String newline = line; String unitid = "-"; storeddate = new SimpleDateFormat("yyyy-MM-dd").format(new java.util.Date()); storedtime = new SimpleDateFormat("HH:mm:ss").format(new java.util.Date()); String sql2 = "delete from t_currentport where PortNumber='" + port1 + "''"; st2.executeUpdate(sql2); sql2 = "insert into t_currentport (unitid, portnumber,thedate,thetime) values >('" + unitid + "','" + port1 + "','" + storeddate + "','" + storedtime + "')"; st2.executeUpdate(sql2); String tablename = GetTable(); String sql = "select * from t_studentdetails where Unitid='" + unitid + "'"; ResultSet rst = st2.executeQuery(sql); if (rst.next()) { Rollno = rst.getString("Rollno"); name = rst.getString("name"); div = rst.getString("div"); } String sql1 = "insert into studentInfo StoredDate,StoredTime,Subject,UnitId,Body,Status,Rollno,div,VehId,MailDate,MailTime,MailFrom,MailTo,Header,UnProcessedStamps) values('" + storeddate + "','" + storedtime + "','" + unitid + "','" + unitid + "','" + newline + "','Pending','" + Rollno + "','" + div + "','" + name + "','" + storeddate + "','" + storedtime + "','" + mailfrom + "','" + mailfrom + "','-','-')"; st1.executeUpdate(sql1); } catch (Exception e) { System.out.print("Save to db Connection Exception--" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "-->" + e); } } }

    Read the article

  • How to resolve this very heavy query that slows down the application?

    - by Juan Paredes
    Hi, We have a web application running in a production enviroment and at some point the client complained about how slow the application got. When we checked what was going on with the application and the database we discover this "precious" query that was being executed by several users at the same time (thus inflicting a extremely high load on the database server): SELECT NULL AS table_cat, o.owner AS table_schem, o.object_name AS table_name, o.object_type AS table_type, NULL AS remarks FROM all_objects o WHERE o.owner LIKE :1 ESCAPE :"SYS_B_0" AND o.object_name LIKE :2 ESCAPE :"SYS_B_1" AND o.object_type IN(:"SYS_B_2", :"SYS_B_3") ORDER BY table_type, table_schem, table_name Our application does not execute this query, I believe it is an Hibernate internal query. I've found little information on why Hibernate does this extremely heavy query, so any help is very much appreciated! The production enviroment information: Red Hat Enterprise Linux 5.3 (Tikanga), JDK 1.5, web container OC4J (whitin Oracle Application Server), Oracle Database 10g Release 10.0.0.1, JDBC Driver for JDK 1.2 and 1.3, Hibernate version 3.2.6.ga. Thank you.

    Read the article

  • Using Spring's KeyHolder with programmatically-generated primary keys

    - by smayers81
    Hello, I am using Spring's NamedParameterJdbcTemplate to perform an insert into a table. The table uses a NEXTVAL on a sequence to obtain the primary key. I then want this generated ID to be passed back to me. I am using Spring's KeyHolder implementation like this: KeyHolder key = new GeneratedKeyHolder(); jdbcTemplate.update(Constants.INSERT_ORDER_STATEMENT, params, key); However, when I run this statement, I am getting: org.springframework.dao.DataRetrievalFailureException: The generated key is not of a supported numeric type. Unable to cast [oracle.sql.ROWID] to [java.lang.Number] at org.springframework.jdbc.support.GeneratedKeyHolder.getKey(GeneratedKeyHolder.java:73) Any ideas what I am missing?

    Read the article

  • how to store BigInteger values in oracle database.

    - by Bipul
    I have connected Java program to Oracle database using JDBC. I want to store BigInteger values(512 bits) in the database. What should be the type of the column? I m trying like this: I have taken a column of number type in the database. I converted BigInteger to BigDecimal like this: BigInteger b=new BigInteger("5779857570957802579079"); Number n =b; BigDecimal d=(BigDecimal)n; PreparedStatement pstmt=con.prepareStatemant("insert into database values(?,?)"); pstmt.setString(1,"john"); pstmt.setBigDecimal(2,d); I am getting the following exception: javax.servlet.ServletException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.math.BigDecimal root cause java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.math.BigDecimal Is there anything wrong in this code snippet? If there is, please suggest other methods.

    Read the article

  • Error preparing statement in Jasper

    - by Augusto
    Hi, I'm trying to create a report with Jasper, but I keep getting this exception when running from my app (runs ok from IReport): net.sf.jasperreports.engine.JRException: Error preparing statement for executing the report query Here's the query I'm using: SELECT produtos.`Descricao` AS produtos_Descricao, saidas.`Quantidade` AS saidas_Quantidade, saidas.`Data` AS saidas_Data, motivossaidas.`Motivo` AS motivossaidas_Motivo FROM `produtos` produtos INNER JOIN `saidas` saidas ON produtos.`Id` = saidas.`Id_Produto` INNER JOIN `motivossaidas` motivossaidas ON saidas.`Id_MotivoSaida` = motivossaidas.`id` WHERE motivossaidas.`motivo` = $P{MOTIVO} and the parameter definition: <parameter name="MOTIVO" class="java.lang.String"/> The exception occurs when I do JasperPrint jasperPrint = JasperFillManager.fillReport(relatorio, parametros); where relatorio is a JasperReport object loaded with JRLoader.loadObject(URL) and parametros is a HashMap with the following key/values: REPORT_CONNECTION = MySQL JDBC connection, MOTIVO = "Venda" I really don't know what to do here. I keep getting the exception event if I use a query without any parameters. Why do I get this exception? What should I do here? Thanks!

    Read the article

  • building a web application in eclipse

    - by Noona
    As a concluding assignment for the technologies taught in a data management course, we have to write a web application using the technologies taught throughout the course, this mostly includes xhtml, css, JSP, servelets, JDBC, AJAX, webservices. the project will eventually be deployed using tomcat. we are given the option of choosing the technologies that we see fit. since this is my first time developing a web application I am having some uncertainties about where to start, so for example now I am writing the object classes that will be used in the database and implementing the operations that will be performed on the database, but I am not sure about how to make these operations available to a client through the website, I mean I think I have to write a servlet through which I can extract the request parameters and set the response accordingly, but I would still like a more specific overview of what I am going to do, so if someone can link me to a tutorial with an example that makes use of these technologies while illustrating the stages of the design so that I can see how all these things are linked together in a web project. thanks

    Read the article

  • DAO design pattern and using it across multiple tables

    - by Casey
    I'm looking for feedback on the Data Access Object design pattern and using it when you have to access data across multiple tables. It seems like that pattern, which has a DAO for each table along with a Data Transfer Object (DTO) that represents a single row, isn't too useful for when dealing with data from multiple tables. I was thinking about creating a composite DAO and corresponding DTO that would return the result of, let's say performing a join on two tables. This way I can use SQL to grab all the data instead of first grabbing data from one using one DAO and than the second table using the second DAO, and than composing them together in Java. Is there a better solution? And no, I'm not able to move to Hibernate or another ORM tool at the moment. Just straight JDBC for this project.

    Read the article

  • Are there any issues with MySQL's i18n(indic language) support ?

    - by anjanb
    Hi All, We're evaluating MySQL and PostgreSQL for building our indic language web application which will use MySQL or PostgreSQL. One of my colleagues mentioned that MySQL had issues with i18n. I mostly come from the Oracle world and although I've played a lil with MySQL, I don't know enough to know that there are issues with its i18n support. Does anyone know issues with MySQL's i18n support and if PostgreSQL would be better placed for building an application with indic language support(kannada, telugu, tamil, etc) ? Just so you know, we're going to be using J2EE to build this application and we will be using JDBC drivers to access the DB. P.S : Will anything change if we were to use Rails to build the app instead of J2EE ? Thank you,

    Read the article

  • How to create proc under /proc/driver?

    - by Mustika_wiguna
    I want to create a proc file under /proc/driver directory. I would like to use a macro like proc_root_driver (or something else provided) rather than use "driver/MODULE_NAME" explicitly. I use create_proc_entry : ... struct proc_dir_entry *simpleproc_fops_entry; simpleproc_fops_entry = create_proc_entry(MODULE_NAME, 0400, NULL /* proc_root_dir */); ... After googling, I found suggestion to use proc_root_driver, but when I use it, error "proc_root_driver undeclared in this function". And also, proc_root_driver is not available in linux/proc_fs.h. I have tried to declare structure like this: struct proc_dir_entry proc_root; struct proc_dir_entry *proc_root_driver = &proc_root; Errors gone, but proc file didn't exist under /proc/driver or /proc Anyone here can help me? Thanks in advances.

    Read the article

  • Need help in setting application name with JPA (EclipseLink)

    - by enrique
    hello everybody i am using JPA with EclipseLink and oracle as DB and i need to set the property v$session of jdbc4 it allows to set an identification name to the application for auditing purposes but i had no lucky setting it up....i have been trying through entitiyManager following the example in this page: http://wiki.eclipse.org/Configuring_a_EclipseLink_JPA_Application_(ELUG) it does not show any error but does not set the application name at all... when i see the audit in oracle it is not being audited with the name i set by code "Customers" but with OS_program_name=JDBC Thin Client it means that the property in the code is not being set properly and i have no idea where the issue is, the code i am using is the following : emProperties.put("v$session.program","Customers"); factory=Persistence.createEntityManagerFactory("clients",emProperties); em=factory.createEntityManager(emProperties); em.merge(clients); does anybody know how to do it or any idea.... thanks.-

    Read the article

  • MySQL with Java: Open connection only if possible

    - by emempe
    I'm running a database-heavy Java application on a cluster, using Connector/J 5.1.14. Therefore, I have up to 150 concurrent tasks accessing the same MySQL database. I get the following error: Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Too many connections This happens because the server can't handle so many connections. I can't change anything on the database server. So my question is: Can I check if a connection is possible BEFORE I actually connect to the database? Something like this (pseudo code): check database for open connection slots if (slot is free) { Connection cn = DriverManager.getConnection(url, username, password); } else { wait ... } Cheers

    Read the article

  • Finding Windows printer driver name using API

    - by Scott Bussinger
    I can't seem to find an API call that returns the driver name for a Windows printer. Note that I'm not talking about the friendly name of the printer in the printer folder, I'm talking about the name of actual driver being used as shown on the "Advanced" tab when you look at the printer properties: I'm trying to detect when I'm printing to the "Generic / Text Only" driver regardless of what name the user chooses for the printer. It doesn't seem like this should be hard, but I can't find it in the DEVMODE structure or anyplace else I've thought to look for it. Thanks for the help!

    Read the article

  • Reusing of a PreparedStatement between methods?

    - by MRalwasser
    We all know that we should rather reuse a JDBC PreparedStatement than creating a new instance within a loop. But how to deal with PreparedStatement reuse between different method invocations? Does the reuse-"rule" still count? Should I really consider using a field for the PreparedStatement or should I close and re-create the prepared statement in every invocation? (Of course an instance of such a class would be bound to a Connection which might be a disadvantage) I am aware that the ideal answer might be "it depends". But I am looking for a best practice for less experienced developers that they will do the right choice in most of the cases.

    Read the article

  • What is the most "database independent" way of creating a variable length text field in a database

    - by Thibaut Colar
    I want to create a text field in the database, with no specific size (it will store text of length unknown in some case) - the particular text are serialized simple object (~ JSON) What is the most database independent way to do this : - a varchar with no size specified (don't think all db support this) - a 'text' field, this seems to be common, but I don't believe it's a standard - a blob or other object of that kind ? - a varchar of a a very large size (that's inefficient and wastes disk space probably) - Other ? I'm using JDBC, but I'd like to use something that is supported in most DB (oracle, mysql, postgresql, derby, HSQL, H2 etc...) Thanks.

    Read the article

  • How to update mutual entries in DB?

    - by Sthita
    I am not able to perform mutual update to my Database. My Requirement is like this : Insert IDS UPDate DB Entries ID ConnectedTo ID connectedTo connectedVia 2 1 --- No Entry ----- 2 3 -- No Entry ----- When ID 1 Comes in to picture (Enties happened to Table) 1 4 1 3 2 1 5 2 4 1 1 2 2 5 1 When ID 3 Comes into picture (Enties happened to Table) 3 4 3 5 1 3 1 ---- 3 2 ---- Similarly when ID 4 Comes in to picture 4 9 4 2 3 4 10 4 5 1 4 3 4 2 1 4 1 1 9 4 1 10 4 Its basically Updating the mutual connections.No Duplicate entries should happen. Like for example 2 3 and 3 2 are mutually connected and 1 is associated with them so there is no need to insert (3 2 via 1). I think this is my requirement. Anything possible combinations i have missed please let me know. i will Update. Please help me writing the logic or any example using jdbc and java.

    Read the article

  • Windows 7 XP mode missing driver virtual pc integration device

    - by Charlie Wu
    I have XP Mode installed fine, but the shipped Windows XP installation is too heavy. I tried to install a light XP using my ASUS Eee PC. After installation, I have to install a few missing drivers and everything worked OK except I can't copy and paste between host and guest operating system. I checked Device Manager and found the Virtual PC Integration Device is not installed correctly. I can't find any driver for that. How can I fix this problem?

    Read the article

  • n900 Windows driver

    - by Walter White
    Hi all, I have an n900 and am attempting to use it for tethering. On Ubuntu Linux, this works perfectly fine, I don't need to install any drivers; however, on the Windows equivalent - Windows XP in my case, I don't seem to have any drivers for it. Is there a driver I need to download to make this happen, if so, where can I find it? Thanks, Walter

    Read the article

  • What is the Apple Mikey HID Driver for?

    - by Ivan Vucica
    Cheers, does anyone know what component in Macbook identifies itself as "Apple Mikey HID Driver"? Joystick and Gamepad Tester detected my gamepad, the keyboard (with each key as a separate axis/button/whatever) and this mysterious device (with single axis/button identified as 'Page: 0x6, Usage: 0x22' which doesn't update). This is in white Unibody Macbook '09. Remark: While Googling for the component, I stumbled upon this mailing list post mentioning Apple IR?

    Read the article

  • How to identify specific chipset driver on client to add to WDS driver database?

    - by Sandy
    I have two new models to support, Optiplex 790 and Lenovo L520. I need to add their chipset drivers to the Windows Deployment server and Intel's driver package is a suite of chipset drivers. WDS discovers way too many: Prior to installing the chipset, SM_Bus shows a yellow exclamation in the Device Manager. When I install Intel's suite, the drivers are installed and SM_Bus is gone. How can I identify which drivers are being used?

    Read the article

  • How to install windows without graphic's driver?

    - by Mike Redford
    My notebook's(Compaq Presario V5000) graphic card damaged last week and after that it will be restarted when I want to boot. So I tested it via windows live, and it booted from CD without any problem (as you know in win live, the graphic card doesn't recognize, and in setting of graphic card write : unknown ) Now my question : Is there anyway to install windows without any graphic driver please ?for example, Should I delete some installation files ?! PS : I tested Windows XP , VISTA and 7 but, when it goes to GUI installation restarted again :( Thanks for your help

    Read the article

  • recomile kernel with tun/tap driver

    - by prince
    how can i recompile linux kernel with TUN/TAP driver on fedora 10. so what is different between upgrade the kernel and compile the kernel? so i want help from any one he can help me. cause i am not expert in linux , i am still new in it. my regards,bye

    Read the article

  • "Bug code usb driver" blue screen in windows

    - by trinity
    Hi all, I have dual OS ( Fedora and windows xp ). for the past two months when i use windows xp, i'm frequently getting a blue screen with msg : " bug code usb driver ".Not knowing what to do next , i switch off the system and reboot it. Can anyone help me understand why this is happening , and how to troubleshoot this problem.. Here's the info provided about this problem after system restarts : BCCode : fe BCP1 : 00000004 BCP2 : 88F3BA08 BCP3 : 88E9FB10 BCP4 : 00000000 OSVer : 5_1_2600 SP : 2_0 Product : 256_1

    Read the article

  • Linux Kernel Driver for video capture

    - by Stoopkid
    I have this EasyCap video capture thing with a USBTV007 chip and I really would like to get it working on my little linux mint 17 laptop so that I can capture video for my RC stuff. But I do not know what to do with this linux kernel driver. I don't even know how to get these files, I assume it is something like git. http://linuxtv.org/wiki/index.php/Easycap#USBTV007_EasyCAP I am looking for a beginner friendly explanation on what to do with this: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/media/usb/usbtv

    Read the article

< Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >