Search Results

Search found 1191 results on 48 pages for 'jdbc'.

Page 4/48 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • [Closed] Oracle JDBC connection with Weblogic 10 datasource mapping, giving problem java.sql.SQLExce

    - by gauravkarnatak
    Oracle JDBC connection with Weblogic 10 datasource mapping, giving problem java.sql.SQLException: Closed Connection I am using weblogic 10 JNDI datasource to create JDBC connections, below is my config <?xml version="1.0" encoding="UTF-8"?> <jdbc-data-source xmlns="http://www.bea.com/ns/weblogic/90" xmlns:sec="http://www.bea.com/ns/weblogic/90/security" xmlns:wls="http://www.bea.com/ns/weblogic/90/security/wls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/920 http://www.bea.com/ns/weblogic/920.xsd"> <name>XL-Reference-DS</name> <jdbc-driver-params> <url>jdbc:oracle:oci:@abc.XL.COM</url> <driver-name>oracle.jdbc.driver.OracleDriver</driver-name> <properties> <property> <name>user</name> <value>DEV_260908</value> </property> <property> <name>password</name> <value>password</value> </property> <property> <name>dll</name> <value>ocijdbc10</value> </property> <property> <name>protocol</name> <value>oci</value> </property> <property> <name>oracle.jdbc.V8Compatible</name> <value>true</value> </property> <property> <name>baseDriverClass</name> <value>oracle.jdbc.driver.OracleDriver</value> </property> </properties> </jdbc-driver-params> <jdbc-connection-pool-params> <initial-capacity>1</initial-capacity> <max-capacity>100</max-capacity> <capacity-increment>1</capacity-increment> <test-connections-on-reserve>true</test-connections-on-reserve> <test-table-name>SQL SELECT 1 FROM DUAL</test-table-name> </jdbc-connection-pool-params> <jdbc-data-source-params> <jndi-name>ReferenceData</jndi-name> <global-transactions-protocol>OnePhaseCommit</global-transactions-protocol> </jdbc-data-source-params> </jdbc-data-source> When I run a bulk task where there are lots of connections made and closed, sometimes it gives connection closed exception for any of the task in the bulk task. Below is detailed exception' java.sql.SQLException: Closed Connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:207) at oracle.jdbc.driver.OracleStatement.ensureOpen(OracleStatement.java:3512) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3265) at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3367) Any ideas?

    Read the article

  • JDBC resultset close

    - by KM
    I am doing profiling of my Java application and found some interesting statistics for a jdbc PreparedStatement call: Given below is the environment details: Database: Sybase SQL Anywhere 10.0.1 Driver: com.sybase.jdbc3.jdbc.SybDriver connection pool: c3p0 JRE: 1.6.0_05 The code in question is given below: try { ps = conn.prepareStatement(sql); ps.setDouble(...); rs = ps.executeQuery(); ...... return xyz; } finally { try { if (rs != null) rs.close(); if (ps != null) ps.close(); } catch (SQLException sqlEx) { } } From JProfiler stats, I find that this particular resultspace.close() statement alone takes a large amount of time. It varies from 25 ms to 320s while for other code blocks which are of identical in nature, i find that this takes close to 20 microseconds. Just to be sure, I ran this performance test multiple times and confirmed this data. I am puzzled by this behaviour - Thoughts?

    Read the article

  • Java - JDBC alternatives

    - by Mike
    Hello, this is just teorethical question. I use JDBC with my Java applications for using database (select, insert, update, delete or whatever). I make "manually" Java classes which will contain data from DB tables (attribute = db column). Than I make querys (ResultSet) and fill those classes with data. I am not sure, if this is the right way. But I've read lot of about JDO and another persistence solutions. Can you please recommend some? Which are modern? Will be used in the future? Some advantages of JDO over JDBC (in simple words). I've been able to google lot of this stuff, but opinions from the "first hand" are always best. Thank you for responses, Mike

    Read the article

  • Hibernate or JPA or JDBC or ???

    - by Yatendra Goel
    I am developing a Java Desktop Application but have some confusions in choosing a technology for my persistence layer. Till now, I have been using JDBC for DB operations. Now, Recently I learnt Hibernate and JPA but still I am a novice on these technologies. Now my question is What to use for my Java Desktop Application from the following? JPA Hibernate JDBC DAO any other suggestion from you... I know that there is no best choice from them and it totally depends on the complexity and the requeirements of the project so below are the requirements of my project It's not a complex application. It contains only 5 tables (and 5 entities) I wan't to make my code flexible so that I can change the database later easily The size of the application should remain as small as possible as I will have to distribute it to my clients through internet. It must be free to use in commercial development and distribution.

    Read the article

  • NoClassDefFound error - Spring JDBC

    - by glowcoder
    Right now, I'm compiling my .class files in eclipse and moving them over to my %tomcat_home%\webapps\myapp\WEB-INF\classes directory. They compile just fine. I also have in the ...\classes directory a org.springframework.jdbc-3.0.2.RELEASE.jar which I have verified has the org.springframework.jdbc.datasource.DriverManagerDataSource class inside it. However, I get a NoClassDefFound error when I run my class and it tries to DriverManagerDataSource source = new DriverManagerDataSource(); I don't understand why it wouldn't be finding that jar. Any help is appreciated!

    Read the article

  • using JDBC with persistence.xml

    - by moshe shamy
    I am building a framework that manage the access to the database. the framework getting tasks from the user and handle a connection pooling that manage the access to the database. the user just send me SQL commands. One of the feature that i would like to support is working with JPA, in this case i will provide entity manager. in some cases i would like to provide JDBC access as well as JPA access. the arguments for the database are written in XML file. so for JPA i need to write the property in persistence.xml so it will be not so smart to write again the same arguments for JDBC. do you know if i can get the arguments of the database from persistence.xml, do you know if there is a source code that do it. or should i parse persistence.xml by myself?

    Read the article

  • jdbc query - date ranges as parameters

    - by pstanton
    Hi all, I'd like to write a single JDBC statement that can handle the equivalent of any number of NOT BETWEEN date1 AND date2 where clauses. By single query, i mean that the same SQL string will be used to create the JDBC statements and then have different parameters supplied. This is so that the underlying frameworks can efficiently cache the query (i've been stung by that before). Essentially, I'd like to find a query that is the equivalent of SELECT * FROM table WHERE mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? and at the same time could be used with fewer parameters: SELECT * FROM table WHERE mydate NOT BETWEEN ? AND ? or more parameters SELECT * FROM table WHERE mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? AND mydate NOT BETWEEN ? AND ? I will consider using a temporary table if that will be simpler and more efficient. thanks for the help!

    Read the article

  • connecting to MySQL using JDBC in eclipse

    - by Noona
    Hello, So I want to create a JDBC connection to MySQL server that is installed on my pc, here are the steps, I installed MySQL with the username and password "root", downloaded mysql-connector-java and from theere I coped the JAR "mysql-connector-java-5.1.12-bin" to "C:\Sun\SDK\jdk\jre\lib\ext", I then added it as an external JAR in my project in eclipse, now in my class I have this code: public void initialiseDatabase() { try { // Load the Driver class. Class.forName("com.mysql.jdbc.Driver"); //Create the connection using the static getConnection method databaseConnection = DriverManager.getConnection (databaseUrl+databaseName, dbUserName, dbPassword); sqlStatement = databaseConnection.createStatement(); } catch (SQLException e) {e.printStackTrace();} catch (Exception e) {e.printStackTrace();} } (this is going to be psuedocode cause I am reading from a properties file and don't want the one helping me reading through long lines of code from main to figure out all the variables), where databaseUrl = "127.0.0.1" dbUserName = "root" dbPassword = "root" databaseName = "MySQL" //this one I am not sure of, do I need to create it or is it set inherenrly? now the MySQL server is up and running, but when I call the method initialiseDatabase the following exception is thrown: "java.sql.SQLException: No suitable driver found for rootroot at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at Proxy$JDBCConnection.initialiseDatabase(Proxy.java:721)" when line 721 is: sqlStatement = databaseConnection.createStatement(); Where have I gone wrong? thanks

    Read the article

  • Using Hibernate with MS ACCESS 2007 Database (Free JDBC Driver)

    - by Quentin T.
    1. I want to do a reverse engineering action with the Hibernate plugin of Eclipse on a MS Access 2007 Database. I'm forced to use a existing MS Access 2007 db. A easy solution is to buy the HXTT. But I want to use a free driver to do my work. So I tried to apply this post : http://www.programmingforfuture.com/2011/06/how-to-use-ms-access-with-hibernate.html (That uses the SQL Server dialect and the driver sun.jdbc.odbc.JdbcOdbcDriver) Unfortunately I have an error that nobody seems to have been on the internet: Exception while generating code Reason : org.hibernate.exception.GenericJDBCException: Error while reading primary key meta data for `c:/myaccessdb.mdb`.TableTest1 I have try to change the primary key on my MS Access DB (deleting all primary key) or to try the reverse engineering on a MS ACCESS with only one table without primary key, but I got all times the problems. 2. The purpose of my job is to transfer daily (weekly) an Oracle 11g database with data from an existing database MS ACCESS 2007. And I thought to use a procedure (Hibernate EJB) Java to be launched automatically every week to do the data transfer. Is this is the best solution ? Configuration : sun.jdbc.odbc.JdbcOdbcDriver v??? Hibernate v3.4 Eclipse ps: If you are a HXTT developer or seller please be indulgent with my post ;). Making money by making people believe that you help, it's bad ! A solution is to use Derby Client driver, as the solution in the post: Does anyone know if Hibernate and java will work effectively with Access? But a clarification of the answer of Rich Seller is required. Could you explain your answer and explain your configuration (hibernate.cfg.xml, persistence.xml and what URL you use in the property name="hibernate.connection.url") without using paying HXTT driver but with the free Derby driver.

    Read the article

  • Batch processing JDBC

    - by Wai Hein
    I am practicing JDBC batch processing and having errors: error 1: Unsupported feature error 2: Execute cannot be empty or null Property files include: itemsdao.updateBookName = Update Books set bookname = ? where books.id = ? itemsdao.updateAuthorName = Update books set authorname = ? where books.id = ? I know I can execute about DML statements in one update, but I am practicing batch processing in JDBC. Below is my method public void update(Item item) { String query = null; try { connection = DbConnector.getConnection(); property = SqlPropertiesLoader.getProperties("dml.properties"); connection.setAutoCommit(false); if ( property == null ) { Logging.log.debug("dml.properties does not exist. Check property loader or file name is spelled right"); return; } query = property.getProperty("itemsdao.updateBookName"); statement = connection.prepareStatement(query); statement.setString(1, item.getBookName()); statement.setInt(2, item.getId()); statement.addBatch(query); query = property.getProperty("itemsdao.updateAuthorName"); statement = connection.prepareStatement(query); statement.setString(1, item.getAuthorName()); statement.setInt(2, item.getId()); statement.addBatch(query); statement.executeBatch(); connection.commit(); }catch (ClassNotFoundException e) { Logging.log.error("Connection class does not exist", e); } catch (SQLException e) { Logging.log.error("Violating PK constraint",e); } //helper class th finally { DbUtil.close(connection); DbUtil.closePreparedStatement(statement); }

    Read the article

  • NamedParameterJdbcTemplate jconnect decimal issue

    - by user1052849
    I am using NamedParameterJdbcTemplate to insert data into a table. (Spring 2.5.3/Java 1.6) I am using jconnect driver to connect to sybase jdbc:sybase:Tds:<Server>:<Port>. For some reason the decimal values the decimal part is truncated. With the same code if I use jtds driver (jdbc:jtds:sybase://<Servername>:<Port>) its working fine. I cannot use jtds as jconn is being used by other code. In Java objects, field is defined as double. In database, field is defined as float (numeric with precision does not work). Any help is appreciated.

    Read the article

  • Crystal reports - connection to JDBC failed

    - by Gabriela
    Hello, I am trying to make a connection to JDBC(JNDI) in Crystal Reports and I get the following error : Invalid Argument provided. Details: Java Server startup failure. Please verify the PATH (JDK), CLASSPATH and IORFileLocation properties in the CRConfig.xml file. In addition, please verify you are using JDK 1.4. I am using the connector : mysql-connector-java-5.1.6-bin.jar, jDK 1.6. Thank you!

    Read the article

  • Connection pooling options with JDBC: DBCP vs C3P0

    - by Dema
    What is the best connection pooling library available for Java/JDBC? I'm considering the 2 main candidates (free / open-source): Apache DBCB - http://commons.apache.org/dbcp/ C3P0 - http://sourceforge.net/projects/c3p0 I've read a lot about them in blogs and other forums but could not reach a decision. Is there any relevant alternatives to this two?

    Read the article

  • Specifying a variable name in QUERY WHERE clause in JDBC

    - by Noona
    Could someone please give me a link on how to create a query in JDBC that gets a variable name in the WHERE statement, or write an example, to be more specific, my code looks something like this: private String getLastModified(String url) { String lastModified = null; ResultSet resultSet; String query = "select LastModified from CacheTable where " + " URL.equals(url)"; try { resultSet = sqlStatement.executeQuery(query); } Now I need the syntax that enables me to return a ResultSet object where URL in the cacheTable equals url from the method's argument. thanks

    Read the article

  • SQL Server JDBC Exception

    - by user267581
    When using ANT to build my Java application I keep getting this error. I have tried multiple times to use SQLJDBC.JAR and SQLJDBC4.JAR but continually receive this error message. I am completely stumpped why this error is received even after upgrading to sqljdbc4.jar. [javadoc] java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.6 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.

    Read the article

  • java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

    - by Nitin Garg
    I am trying to connect to mysql database using java on windows7. Inspite of adding the complete url of jdbcdriver jar file in CLASSPATH, java.lang.ClassNotFoundException: com.mysql.jdbc.Driver is thrown. Could anyone tell me what i am missing here?? it works if i add the jar file in project library but i want to do it by CLASSPATH itself. My classpath looks like this- C:\jython2.5.1\javalib\mysql-connector-java-5.1.12-bin.jar

    Read the article

  • jdbc nested transactions

    - by Nrj
    What is the behaviour of nested transactions. I am using java + jdbc ? Eg: tx1.begin do stuff1 tx2.begin do stuff2 tx2.commit do stuff1.1 tx1.rollback tx2 is basically inside another function. Will the results from tx2 be persisted ? In case behaviour is db specific, what is it in case of Sql server 2005 ?

    Read the article

  • JDBC with MySQL

    - by Josh K
    I'm working on getting my database to talk to my Java programs. What do I need to get started? Having already read through (and been thoroughly confused, something that does not happen often) with some other turorials I figured I'd best ask here. How do I import a jar file from the local directory? Can someone give me a quick and dirty sample program using the JDBC?

    Read the article

  • jdbc connection pooling

    - by llm
    Can anybody provide examples or links on how to establish a JDBC connection pool? From searching google I see many different ways of doing this and it is rather confusing. Ultimately I need the code to return a java.sql.Connection object, but I am having trouble getting started..any suggestions welcome.

    Read the article

  • Oracle Cursor and JDBC ODBC

    - by BeginnerAmongBeginners
    I have some procedures to execute in the database that has an OUT REFCURSOR parameter. When I am connecting with the JDBC thin client, everything works fine. However, if I were to change the connection string to refer to the ODBC data source pointing to the same database, those procedures will fail. The procedures that do not use an OUT REFCURSOR will still work fine though. Is this situation the result of an error on my part or expected?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >