Search Results

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

Page 10/266 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • JDBC Connection pool monitoring GlassFish

    - by john
    I am trying to find a setting by which the connection pool monitoring information would come in the server.log whenever an error like "error allocating a connection" or "connection closed" occur. I found some blog entries that talk about this but they mention it from GUI prespective. However, I want a setting on the connection pool itself so that perodically the connection pool monitoring information would be shown in the logs. Does anyone know of such a setting? On Sun app Server 8.X it used to be perf-monitor

    Read the article

  • JDBC ResultSet.getString Before/After Start/End of ResultSet Exception

    - by Geowil
    I have done a lot of searching about this topic through Google but I have yet to find someone using getString() in the way that I am using it so I have not been able to fix this issue in the normal ways that are suggested. What I am trying to do is to obtain all of the information from the database and then use it to populate a table model within the program. I do so by obtaining the data with getString and place it into a String[] object: try { while (rSet.next()) { String row[] = {rSet.getString("DonorName"),rSet.getString("DonorCharity"),((String)rSet.getString("DonationAmount"))}; model.addRow(row); } } However I am always getting a dialog error message stating those error messages in the title: Exception: Before start of result set Exception: After end of result set The data is still added and everything works correctly but it is just annoying to have to dismiss those message windows. Does anyone have some suggestions?

    Read the article

  • Speed up multiple JDBC SQL querys?

    - by paddydub
    I'm working on a shortest path a* algorithm in java with a mysql db. I'm executing the following SQL Query approx 300 times in the program to find route connections from a database of 10,000 bus connections. It takes approx 6-7 seconds to execute the query 300 times. Any suggestions on how I can speed this up or any ideas on a different method i can use ? Thanks ResultSet rs = stmt.executeQuery("select * from connections" + " where Connections.From_Station_stopID ="+StopID+";"); while (rs.next()) { int id = rs.getInt("To_Station_id"); String routeID = rs.getString("To_Station_routeID"); Double lat = rs.getDouble("To_Station_lat"); Double lng = rs.getDouble("To_Station_lng"); int time = rs.getInt("Time"); }

    Read the article

  • Oracle Connection exception via JDBC

    - by sachin
    I have installed Oracle 11gR2 on my machine, now when i try to connect to it using IP address as 'localhost' or '127.0.0.1' there is no issue, but when I use ip address of machine '192.168.1.6' it throws exception: Io exception: Then Network Adapter could not establish the connection. I have installed ms loopback adapter prior to installation and my machine get IP from DHCP. do i need to configure any setting oracle config or what i might be missing here?

    Read the article

  • sql jdbc getgeneratedkeys with mysql returns column "id" not found

    - by iamrohitbanga
    I want to retrieve the most recently updated value in the table using an insert query. these are the datatypes in my sql table. int(11) // primary key auto increment, not being assigned by sqlQuery varchar(30) timestamp // has a default value. but i am explicit assigning it using CURRENT_TIMESTAMP varchar(300) varchar(300) varchar(300) int(11) varchar(300) // java code statement.executeUpdate(sqlQuery, Statement.RETURN_GENERATED_KEYS); ResultSet rs = statement.getGeneratedKeys(); System.out.println("here: " + rs.getMetaData().getColumnCount()); System.out.println("here1: " + rs.getMetaData().getColumnName(1)); // none of the following 3 works System.out.println("id: " + rs.getInt(1)); System.out.println("id: " + rs.getInt("GENERATED_KEY")); System.out.println("id: " + rs.getInt("id")); for a bit of background see this

    Read the article

  • How to create a database deadlock using jdbc and JUNIT

    - by Isawpalmetto
    I am trying to create a database deadlock and I am using JUnit. I have two concurrent tests running which are both updating the same row in a table over and over again in a loop. My idea is that you update say row A in Table A and then row B in Table B over and over again in one test. Then at the same time you update row B table B and then row A Table A over and over again. From my understanding this should eventually result in a deadlock. Here is the code For the first test. public static void testEditCC() { try{ int rows = 0; int counter = 0; int large=10000000; Connection c=DataBase.getConnection(); while(counter<large) { int pid = 87855; int cCode = 655; String newCountry="Egypt"; int bpl = 0; stmt = c.createStatement(); rows = stmt.executeUpdate("UPDATE main " + //create lock on main table "SET BPL="+cCode+ "WHERE ID="+pid); rows = stmt.executeUpdate("UPDATE BPL SET DESCRIPTION='SomeWhere' WHERE ID=602"); //create lock on bpl table counter++; } assertTrue(rows == 1); //rows = stmt.executeUpdate("Insert into BPL (ID, DESCRIPTION) VALUES ("+cCode+", '"+newCountry+"')"); } catch(SQLException ex) { ex.printStackTrace(); //ex.getMessage(); } } And here is the code for the second test. public static void testEditCC() { try{ int rows = 0; int counter = 0; int large=10000000; Connection c=DataBase.getConnection(); while(counter<large) { int pid = 87855; int cCode = 655; String newCountry="Jordan"; int bpl = 0; stmt = c.createStatement(); //stmt.close(); rows = stmt.executeUpdate("UPDATE BPL SET DESCRIPTION='SomeWhere' WHERE ID=602"); //create lock on bpl table rows = stmt.executeUpdate("UPDATE main " + //create lock on main table "SET BPL="+cCode+ "WHERE ID="+pid); counter++; } assertTrue(rows == 1); //rows = stmt.executeUpdate("Insert into BPL (ID, DESCRIPTION) VALUES ("+cCode+", '"+newCountry+"')"); } catch(SQLException ex) { ex.printStackTrace(); } } I am running these two separate JUnit tests at the same time and am connecting to an apache Derby database that I am running in network mode within Eclipse. Can anyone help me figure out why a deadlock is not occurring? Perhaps I am using JUnit wrong.

    Read the article

  • JDBC batch insert performance

    - by wo_shi_ni_ba_ba
    I need to insert a couple hundreds of millions of records into the mysql db. I'm batch inserting it 1 million at a time. Please see my code below. It seems to be slow. Is there any way to optimize it? try { // Disable auto-commit connection.setAutoCommit(false); // Create a prepared statement String sql = "INSERT INTO mytable (xxx), VALUES(?)"; PreparedStatement pstmt = connection.prepareStatement(sql); Object[] vals=set.toArray(); for (int i=0; i

    Read the article

  • JDBC Lock a row using SELECT FOR UPDATE, doesn't work

    - by Rachid
    I am having issues with MySQL's SELECT .. FOR UPDATE, here is the query I am trying to run: SELECT * FROM tableName WHERE HostName='UnknownHost' ORDER BY UpdateTimestamp asc limit 1 FOR UPDATE After this, the concerned thread will do an UPDATE and change the HostName, which is then it should unlock the row. I am running a multi-threaded java application, so 3 threads are running this SQL statement, but when thread 1 runs this, it doesn't lock its results from thread 2 & 3. Therefore threads 2 & 3 are getting the same results and they could update the same row. Also each thread is on its own mysql connection. I'm using Innodb, with transaction-isolation = READ-COMMITTED, and the Autocommit is off before executing the select for update may I miss something? OR perhaps there is a better solution? Thanks a lot. Code : public BasicJDBCDemo() { Le_Thread newThread1=new Le_Thread(); Le_Thread newThread2=new Le_Thread(); newThread1.start(); newThread2.start(); } Thread : class Le_Thread extends Thread { public void run() { tring name = Thread.currentThread().getName(); System.out.println( name+": Debut."); long oid=Util.doSelectLockTest(name); Util.doUpdateTest(oid,name); } } Select : public static long doSelectLockTest(String threadName) { System.out.println("[OUTPUT FROM SELECT Lock ]...threadName="+threadName); PreparedStatement pst = null; ResultSet rs=null; Connection conn=null; long oid=0; try { String query = "SELECT * FROM table WHERE Host=? ORDER BY Timestamp asc limit 1 FOR UPDATE"; conn=getNewConnection(); pst = conn.prepareStatement(query); pst.setString(1, DbProperties.UnknownHost); System.out.println("pst="+threadName+"__"+pst); rs = pst.executeQuery(); if (rs.first()) { String s = rs.getString("HostName"); oid = rs.getLong("OID"); System.out.println("oid_oldest/host/threadName=="+oid+"/"+s+"/"+threadName); } } catch (SQLException ex) { ex.printStackTrace(); } finally { DBUtil.close(pst); DBUtil.close(rs); DBUtil.close(conn); } return oid; } Please help.... : Result : Thread-1: Debut. Thread-2: Debut. [OUTPUT FROM SELECT Lock ]...threadName=Thread-1 New connection.. [OUTPUT FROM SELECT Lock ]...threadName=Thread-2 New connection.. pst=Thread-2: SELECT * FROM b2biCheckPoint WHERE HostName='UnknownHost' ORDER BY UpdateTimestamp asc limit 1 FOR UPDATE pst=Thread-1: SELECT * FROM b2biCheckPoint WHERE HostName='UnknownHost' ORDER BY UpdateTimestamp asc limit 1 FOR UPDATE oid_oldest/host/threadName==1/UnknownHost/Thread-2 oid_oldest/host/threadName==1/UnknownHost/Thread-1 [Performing UPDATE] ... oid = 1, thread=Thread-2 New connection.. [Performing UPDATE] ... oid = 1, thread=Thread-1 pst_threadname=Thread-2: UPDATE b2bicheckpoint SET HostName='1_host_Thread-2',UpdateTimestamp=1294940161838 where OID = 1 New connection.. pst_threadname=Thread-1: UPDATE b2bicheckpoint SET HostName='1_host_Thread-1',UpdateTimestamp=1294940161853 where OID = 1

    Read the article

  • JDBC ResultSet total rows

    - by Zeeshan
    I am implementing Paging in my application. For this i run a query and get a resultset. Now i want to get total no of records in this resultset for my paging calculation. How can i get ? i dont want to execute a extra sql which gives me total rows

    Read the article

  • JDBC resulset total rows

    - by Zeeshan
    I am implementing Paging in my application. For this i run a query and get a resultset. Now i want to get total no of records in this resultset for my paging calculation. How can i get ? i dont want to execute a extra sql which gives me total rows

    Read the article

  • problem in jdbc preparestatement

    - by akshay
    i am geting error when i try to use following,why is it so? ResultSet findByUsername(String tablename,String field,String value) { pStmt = cn.prepareStatement("SELECT * FROM" + tablename +" WHERE ? = ? "); pStmt.setString(1, tablename); pStmt.setString(2,field); pStmt.setString(3,value); return(pStmt.executeQuery()); } also i tried following , but its not working too ResultSet findByUsername(String tablename,String field,String value) { String sqlQueryString = " SELECT * FROM " + tablename +" WHERE " + filed + "= ? ") cn.prepareStatement(sqlQuery); pStmt.setString(1, value); return(pStmt.executeQuery()); }

    Read the article

  • Good JDBC pattern

    - by Java Developer
    What is the good practice for database operation in Java application? Do you construct the DML syntax in the Java code and send the statements to DB engine for execution, or you just collect the parameters and then make a call to stored procedure with the parameters via java code? or neither because that's just not how to do it? can anyone give an example of a full database utility classes to do database operations in Java app? also what about the transaction manager? My assignment is to make database operation that is modular in Java. Thanks

    Read the article

  • JDBC delete statement with multiple columns

    - by user1643033
    It says I ended this statement wrong when if I input it into sql plus with just the addition of ; it works perfectly. What am I doing wrong? Statement statement = connection.createStatement(); statement.executeUpdate("delete from aplbuk MODEL = '"+ textField_4.getText() + "'AND year = '" + textField_1.getText() + "' AND Litres = '" + textField_2.getText() + "' AND ENGINE_TYPE = '" + textField_3.getText() + "'"); statement.close();

    Read the article

  • Check if user in a database is banned JDBC

    - by user2297666
    Using an oracle database, I need to perform a check to see if a user in my 'users' table is banned or not. The user is banned if his column 'banned' has a value of '1', '0' if he is not. I have the following working code here: public boolean banUser(String username) {//TODO check if user is banned already try { pstmnt = conn.prepareStatement("UPDATE users SET banned = 1 WHERE username = ?"); pstmnt.setString(1, username); pstmnt.execute(); logger.info("Banned User : " + username); return true; } catch ( SQLException e ) { e.getMessage(); } return false; } I'm not sure how to perform an if statement on top of a prepared statement. Any ideas?

    Read the article

  • Network driver for Hyper-V restore from Windows Home Server

    - by Philipp Schmid
    I have backed up Windows Server 2008 running virtualized on Hyper-V to a Windows Home Server 2008 SP1 (I know I should have backed up the VHD instead). Now I need to restore the contents of the VM from WHS. I have created a restore CD ISO and used it to create a new VM. It all works as advertised up to the point where the restore process wants to load the network drivers (it only finds 4 disk drivers on the restore CD. but no network drivers). So I created a virtual floppy and copied the contents of 'Home Server Drivers for Restore onto it. But no luck! I have tried moving the 4 subdirectories into the root of the floppy, but that didn't work either. Finally, I started another instance of the WS 2008 to identify the network driver that the virtualized instance is using (%WINDOWS%\system32\drivers\netvsc60.sys) and copied that file onto the virtual floppy, without success. Does anyone have any suggestions on how to get networking working on a Hyper-V instance running off the Windows Home Server Restore CD? UPDATE: As suggested by delenda, I have added a legacy network adapter to my VM, and indeed I now get a network driver listed! However, the WHS it still not found, even after entering the home server name manually. PHS

    Read the article

  • Where to find gtx560Ti driver for ubuntu 12.04?

    - by sam
    I found in this nvidia link : http://www.nvidia.com/object/linux-display-amd64-295.59-driver.html It says Linux x64 (AMD64/EM64T) Display Driver Version: 295.59 Certified Supported: NVS 5400M NVS 310 Quadro 410 GeForce GT 620M GeForce GT 640M GeForce GT 640M LE GeForce GT 650M GeForce GTX 660M GeForce GTX 670M GeForce GTX 675M GeForce GTX 555 GeForce GTX 560 SE GeForce GT 415 GeForce GTX 460 v2 Is that driver support for gtx560Ti? If not ,where is the proper driver? (I don't want to use the driver in ubuntu settings) Thank you~

    Read the article

  • Ubuntu 12.04 + AMD Radeon driver 12.8 problem

    - by wpinacz
    I have a Lenovo G570 laptop with AMD Radeon 6370M GPU. I wanted to install new 12.8 driver from AMD but with no success, after install and reboot, I got a screen with reconfigure graphics driver and it won't work. If I install 12.6 driver it works but I cannot switch to my integrated Intel GPU, only discrete (AMD) GPU is working. Please help with my problem (installing 12.8 driver or switching GPU under 12.6 driver).

    Read the article

  • ipmi driver on windows 2003 R2

    - by rgmarcha
    ipmiutil complains it doesn't find ipmidrv.sys I see it's on \windows\system32\drivers directory, also on \windows\system32\ipmi directory. But, the driver doesn't appear on the output of driverquery command. Any hint on how to enable it? The hardware is a Dell 1950

    Read the article

  • I need ethernet controller driver, PCI bus for Presario 6010US

    - by nathaniel
    Hi I am unable to connect to the internet. ,Just installed the OS XP Pro and the device manager has a yellow question mark for controller driver, PCI bus. My network connection shows I am connected to a firewalled network with zero packets sent and received. I checked HP.COM, with no luck. Please advise what I should do. thank you very much

    Read the article

  • Printer driver unavailable after Windows 7 upgrade

    - by kngofwrld
    Upgraded to Windows 7 and lost the ability to print to my old but still perfect Brother HL-1440 laser printer. I cannot run in XP compatibility mode with my version of Windows (Home Professional). Is there anything that can be done to get printing to work? I just want to print via USB but there is no Windows 7 driver.

    Read the article

  • using Spring JdbcTemplate for multiple database operations

    - by Joel Carranza
    I like the apparent simplicity of JdbcTemplate but am a little confused as to how it works. It appears that each operation (query() or update()) fetches a connection from a datasource and closes it. Beautiful, but how do you perform multiple SQL queries within the same connection? I might want to perform multiple operations in sequence (for example SELECT followed by an INSERT followed by a commit) or I might want to perform nested queries (SELECT and then perform a second SELECT based on result of each row). How do I do that with JdbcTemplate. Am I using the right class?

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >