jdbc

java read JDBC connection from XML file

Anyone have idea how can i write XMl file that i will have JDBC connection (username, passwd, driver, connection) in it and then read that xml for connecting to db? ...

Drop all constraints in Derby via JDBC

How can I drop all constraints in a Derby database via JDBC? ...

How do I set a full date & time sql using java, and not just the date?

I am trying to set a timestamp in my database using java, however in my table all I get is the date, and no time (i.e., looks like "2010-09-09 00:00:00"). I am using a datetime field on my mysql database (because it appears that datetime is more common than timestamp). My code to set the date looks like this: PreparedStatement ps = c...

JDBC: How to read all rows from huge table ?

I have a problem to process all rows from database (PostgreSQL). I get error: "org.postgresql.util.PSQLException: Ran out of memory retrieving query results.". I thing that i need to read all rows in small pieces, but it doesn't work - it read only 100 rows (code below). How to do that ? int i = 0; Statement s = connection...

Sql Server - connect with windows authentication

Hello, i must connect to a sql server with windows authentication sql server is on machine 192.168.3.6 web server (client) is on my machine 192.168.3.10 I'm using JTDS driver dbUrl=jdbc:jtds:sqlserver://192.168.3.6:1099/db_test;instance=test Connection con = DriverManager.getConnection( dbUrl, "", "" ); I have username and password ...

Choosing betwen JDBC or ADO.NET, performance studies on Oracle

Hi, We are starting a new project, wich talks to an Oracle database with millions of data. The system is mission critical and should be highly performant. We are now choosing the technologies that will be involved in the system, and we are doubting between JDBC or ADO.NET for data access. Wich technlogy is most performant? Are there a...

Are there any in-memory JDBC databases that support XA distributed transactions?

I want to use an in-memory database to test my application, but it needs to support XA distributed transactions. My first idea for an in-memory database was HSQLDB, but it appears not to support XA. Are there any? ...

isolation level on a transaction in JDBC with an an auto_incremement field

I have a table that I need to insert records into, the id field is a primary auto_increment field, I am not sure about what isolation level I should use such that no record will be created with the same id when 2 concurrent transactions are working? this is my code: String query = "insert into InstrumentTable values(?,?,?,? )"; ...

Encryption / Decryption sqlite database using java

Hello, Is there any free library / Java API to encrypt and decrypt sqlite database in java ? I am using SQLite JDBC driver as part of xerial project. Thanks, Deep ...

iSeries JDBC Sql statement with "é" in column name throws java.sql.SQLException: [SQL0104]

I am having trouble using the character "é" in a returned column name from an SQL query. Running this query SELECT PRCAT as Categorie, PRYEA as Année, PRDSC as Designation from DEMO.PRODUCT using the IBM Toolbox JDBC driver connecting to an iSeries produces this exception: java.sql.SQLException: [SQL0104] Token é was not valid. Va...

How do I monitor a database for new entries?

I have an application solution which is made up of a web app written in Python (using Django framework) and a Java application which runs on the server. The web application receives data and stores it into a database queue. The Java application is then to process the received data and also store the results in a database. My question ...

oracle connection in jsp

firstly i am a total newbie for both jsp as well as oracle. i just want to know the steps for connecting an oracle 10g database with a jsp page. ...

Java named parameter's name (for Oracle JDBC function result)

I'm going to call a function, and set some parameters by name, example: Connection c = null; ResultSet rs = null; String query; PreparedStatement ps; CallableStatement cs = null; try { c = DbUtils.getConnection(); cs = c.prepareCall("{? = call get_proc_name(?, ?) }"); cs.registerOutParamet...

How do I make a prepared statement?

How can I make an prepared statement of this one? Statement stmt = con.createStatement(); long lastid = getLastId(stmt); // create a SQL query String strQuery = "INSERT INTO studenten " + " (id, naam, adres, postcode, plaats, geboren) " + " VALUES (" + (lastid+1) + "," + "'" + contact.getNaam() + "'," +...

How can I set a timeout on spring DriverManagerDataSource

We are using DriverManagerDataSource from the Spring framework (version 2.5) to pool connections to Oracle. However, it seems that these connections don't have any timeout defined - yesterday, after emergency database restart, we had a thread hanging on a socket read inside the database connection. How can I set the timeout, to say 10 mi...

receiving xml with value null when it's actually null

I'm executing a stored procedure on sql server 2005 from livecycle es 8.2 the result return something like <Table> <Row> <ID>1</ID> <EN_Cd>EN</EN_Cd> <FR_Cd>null</FR_Cd> <EN_Nm>English</EN_Nm> <FR_Nm>Anglais</FR_Nm> <EN_Shrt_Dscrptn>null</EN_Shrt_Dscrptn> <FR_Shrt_Dscrptn>null</FR_Shrt_Dscrptn> </Row> </Tabl...

Problem connectiong to a SQL Server 2008 named instance using Hibernate

Hi, I'm using Hibernate to connect to an SQL Server 2008 named instance. This works if I use the default instance name but not when using the "named" instance. config.setProperty("hibernate.connection.url","jdbc:sqlserver://127.0.0.1\INSTANCE_NAME:1433;databaseName=DB_NAME;autoReconnect=true"); Any ideas why this happens? Thanks i...

JDBC not seeing updated table structure

I am using Coldfusion 8 which is connecting to SQL Server 2008, the problem is I have updated a table adding a new column in SSMS, but the JDBC connection is still 'seeing' the table prior to the change. How can I essentially 'refresh' the JDBC connection? Would restarting the cf server work? ...

How to differentiate SQL statements that modify data from those that are read only?

I need to write a jdbc compliant driver wrapper whose purpose is to log all SQL statements that modify data. What is the easiest way to differentiate those statements that modify data from those that only read data? I guess that only way is to parse SQL code on the fly, any libraries that can do that? ...

Get number of rows,were updated with PreparedStatement

How to get how many rows updated with PreparedStatement? .getUpdateCount() returns 0. For executeUpdate got error: error occurred during batching: batch must be either executed or cleared my code: updTrans = dataSource.getConnection().prepareStatement("update..."); updTrans.setInt(1, Integer.valueOf(transaksjonstatusid)); ... updTran...