DB Connection problem in java

Posted on 2009-07-07
Last Modified: 2013-11-23
Hi ,

i am using below code when i run java envi its says ORA-00911: invalid character
that same query is runing and insert the values in back end !!
can u tell me the problem
String url = "jdbc:oracle:thin:@localhost:1521";
		  try {
				try {
					// System.out.println("Failed to load isqlPlus driver.");
					//DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
				catch (Exception ae) {
				try {
					String url1 = System.getProperty("JDBC_URL");
					if (url1 != null)
						url = url1;
					Connection con = DriverManager.getConnection(url,
							"system", "tspl");
					PreparedStatement psmnt=null;
					String query="insert into gen_info(EMP_NAME,EMP_ID,TECH) "+ "values(?,?,?);";
					//Statement st=con.createStatement();
					psmnt = con.prepareStatement(query);
				boolean s = psmnt.execute();
					if (s)
						System.out.println("Succesfully inserted");
						System.out.println("Cant Insert");
				} catch (Exception e) {
			} catch (Exception e) {

Open in new window

  • 2
LVL 92

Expert Comment

ID: 24792896
try getting rid of the ;
LVL 20

Author Comment

by:Sathish David Kumar N
ID: 24792903
what i didnt get u ??
LVL 92

Accepted Solution

objects earned 500 total points
ID: 24792911
the ; at the end of your sql
LVL 15

Expert Comment

ID: 24792944
in line 21 , will it cause by missed space in sql statement?
String query="insert into gen_info (EMP_NAME, EMP_ID, TECH) "+ " values(?,?,?) ";
also, you can try System.out.println(query) to see is there any invalid characters ?

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to see all occupied ports on windows 10 laptop 15 76
spring jars download 1 35
jboss 7.1 start up error 1 39
learn programming 8 42
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question