Solved

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

Posted on 2015-02-02
6
119 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
  • 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 200 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 52

Accepted Solution

by:
_agx_ earned 300 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now