|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
SQL string is not Query
Hi,
I have a problem...I have a j2ee application that execute with a JSP page a SQL QUERY this application execute query on DB with DB9i this application work but with DB10g don't work. If I execute a SELECT query with the JDBC(jdbc driver for 9i) connect on DB10g the Query work but if I execute the INSERT or UPDATE query JSP don't work and I receving this error "SQL string is not Query". Why??? I write the source code of my JSP: __________________________________ <%@page import="java.sql.*, java.io.*, javax.naming.*, javax.sql.*, oracle.jdbc.driver.*,java.util.*,java.net.*"%> <% //--------------------- DICHIRAZIONI VARIABILI NECESSARIE PER LA CONNESSIONE AL DB ----------- String dbase="jdbc racle:thin:@localhost:1521:test";String login="test"; String pwd="test123"; // -------------------- DRIVER JDBC ---------------------------------------- DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Class.forName("oracle.jdbc.driver.OracleDriver"); out.println("Test <br>"); String QueryProt = "INSERT INTO TEST_CEDA (ID) VALUES (?)"; Connection con_d; PreparedStatement ps_d; Statement stmt_d; ResultSet rs_d; String Prot=""; String Protoc=""; con_d = DriverManager.getConnection(dbase,login,pwd); stmt_d = con_d.createStatement(); // rs_d = stmt_d.executeQuery(QueryProt,11); ps_d=con_d.prepareStatement(QueryProt); ps_d.setInt(1,100); rs_d= ps_d.executeQuery(); if(rs_d.next()) { //Prot=rs_d.getString("id"); rs_d.close();stmt_d.close();con_d.close(); //out.println("ciao "+Prot); } else { rs_d.close();stmt_d.close();con_d.close(); out.println("ciao no"); } %> __________________________________ Best Regards Basilisco Giorgio Servizi di Rete CDS Università degli Studi di Napoli Federico II Via Cinthia - Complesso Universitario Monte S.Angelo - Ed. Centri Comuni |
|
#2
|
||||
|
||||
|
Why don't you try the new driver first? (i.e. 10g driver to 10g database?) I've experiences several problems using drivers that didn't match the db version.
See http://otn.oracle.com/software/tech...jdbc/index.html for downloads.
__________________
My blog about OpenSource Databases PDF tutorials about OSS databases, DBMonster ... Please contribute to Open Source Development, fill bug reports!!! Developer Shed eSupport Commented my.ini/my.cnf (PLEASE ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins |
|
#3
|
|||
|
|||
|
re:
I have try tha install the driver jdbc10g on my ApplicationServer (I have copy the file, that I have download of your link,in the folder of my applicationServer)but these don't work.
I have a question the my JSPapplication can use the your driver 10g and don't use the driver10g of my ApplicationServer? |
|
#4
|
||||
|
||||
|
If you are using Tomcat you can put the jdbc driver in the /contextname/WEB-INF/lib folder where it will be available for that specific application only.
|
|
#5
|
|||
|
|||
|
The drivers are correct. A "query" is a SELECT -- it returns a series of rowsets, INSERT, UPDATE and DELETE are DML statements, not queries, they don't return rowsets. If you want to execute DML you should call "execute" instead of "executeQuery". That's a lot easier than installing updated drivers.
|
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > SQL string is not Query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|