Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Error Executing Database Query. Syntax error: Encountered "(" at line 10, column 37.

Posted on 2015-02-02
6
Medium Priority
?
183 Views
Last Modified: 2015-02-08
I have to learn cold fusion for and upcoming project ... I'm trying to set up a simple database coldfsion11 apache derby embedded (I have no experience with apache derby) ... But I keep getting the same syntax error ... maybe a fresh set of eyes can tell me what I am doing wrong


 Error Executing Database Query.
Syntax error: Encountered "(" at line 10, column 37.
 
The error occurred in C:/ColdFusion11/cfusion/wwwroot/SRPT/DatabaseCreator.cfc: line 80
Called from C:/ColdFusion11/cfusion/wwwroot/SRPT/createdatabase.cfm: line 7
Called from C:/ColdFusion11/cfusion/wwwroot/SRPT/DatabaseCreator.cfc: line 80
Called from C:/ColdFusion11/cfusion/wwwroot/SRPT/createdatabase.cfm: line 7

78 : 		<cffunction name="createevent" access="public" returnType="String" >
79 : 			<cfset  droptable('locTab')>
80 : 		<cfquery datasource = "Reports">
81 : 		CREATE TABLE
82 : 			 locationTable(loctabID INTEGER
                                                    NOT NULL 
                                                 GENERATED ALWAYS AS IDENTITY,

<cffunction name="createevent" access="public" returnType="String" >
			<cfset  droptable('locTab')>
		<cfquery datasource = "Reports">
		CREATE TABLE
			 locationTable(loctabID INTEGERS NOT NULL GENERATED ALWAYS AS IDENTITY,
		    	usersID VARCHAR(50),
		    	WawaID VARCHAR(50),
		    	AccesLevel VARCHAR(50),
		    	date VARCHAR(50),
		    	name VARCHAR(50),
		    	postalcode VARCHAR(50),
		    	city VARCHAR(50),
		    	state VARHAR(50),
		    	zip VARCAHR(50))
			
		</cfquery>
			</cffunction>


 Error Executing Database Query.
Syntax error: Encountered "(" at line 10, column 43.
 
The error occurred in C:/ColdFusion11/cfusion/wwwroot/SRPT/DatabaseCreator.cfc: line 123
Called from C:/ColdFusion11/cfusion/wwwroot/SRPT/createdatabase.cfm: line 9
Called from C:/ColdFusion11/cfusion/wwwroot/SRPT/DatabaseCreator.cfc: line 123
Called from C:/ColdFusion11/cfusion/wwwroot/SRPT/createdatabase.cfm: line 9

121 : 			
122 : 		
123 : 		<cfquery datasource="Reports">
124 : 		CREATE TABLE
125 : 			Patient(PatientID INTEGER

<cffunction name="createincident" access="public" returntype="String" >
			
		
		<cfquery datasource="Reports">
		CREATE TABLE
			Incident (IncidentID INTEGER
				NOT NULL
			    GENERATED BY DEFAULT AS IDENTITY (START WITH 53)
		    	CONSTRAINT Incident_PK PRIMARY KEY,
		    	usersID VARCHAR(50),
		    	WawaID VARCHAR(50),
		    	loctabID VARCHAR(50),
		    	AccesLevel VARCHAR(50),
		    	date VARCHAR(50),
		    	time VARCHAR(50),
		    	incident_num VARCHAR(50),
		    	lastname VARCHAR(50),
		    	firstname VARCHAR(50)
		    	
			)
		</cfquery>
		
		
		</cffunction>

Open in new window

0
Comment
Question by:dolamitejenkins
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 39

Expert Comment

by:gdemaria
ID: 40585439
I don't even know if you can create a table through coldfusion - do you have "create" checked off for the data source in the CFIDE/Administrator?

Depending on which database there are some things I wonder if are legal, you're using "date" and "time" as column names, that may be reserved words.

I think it's odd to create and drop tables through your application - why not just make the tables and then delete and fill them instead of drop/create them?
0
 

Author Comment

by:dolamitejenkins
ID: 40585492
actually using lyndia to learn an the example does it this way but only creates 2 tables .... I will chech the date and time and see if that is the problem ... how else do you create a database in cold fusiom ... server side work in not my thing I'm trying to learn fast
0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 800 total points
ID: 40585496
just connect to the database and create the table in there, nothing to do with coldfusion.   Then let coldfusion create and delete the records as needed.

Do you have more than one user accessing these report tables?  If so, you need to add/delete records by user, if you delete all, or drop the table, all the users will be effected, right?
0
How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

 
LVL 52

Accepted Solution

by:
_agx_ earned 1200 total points
ID: 40586637
>> actually using lyndia to learn an the example does it this way

I agree with GD. While technically you can create/drop tables through CF, normally you just connect to your database directly using a GUI tool.

To answer your question, you misspelled a few of the data types. That's the cause of the syntax error.


CREATE TABLE
     locationTable(loctabID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
     ...
     state VARCHAR(50),
     zip VARCHAR(50)
)


>> apache derby

I know you're following an example, but keep in mind you can use any database you want. The examples use Apache Derby database.because it's easy to embed. I've never used it outside of running examples.  If you'll ultimately be working with a different database like SQL Server or MySQL, you might want to start with that instead.
0
 

Assisted Solution

by:dolamitejenkins
dolamitejenkins earned 0 total points
ID: 40586936
great point thanks
0
 

Author Closing Comment

by:dolamitejenkins
ID: 40596624
Thank you
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

730 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