Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!

Georgios Adamidis

Ranch Hand
+ Follow
since Dec 02, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
4
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Georgios Adamidis

Knute Snortum wrote:Just guessing, but is your CentreCode in the column shopping_centers.shopping_centre_ga?


yes it is shoppingCentre_GA
I am trying to input data in my tables and i keep getting the following error codes "#4025 - CONSTRAINT `CHK_CentreCode` failed for `shopping_centres`.`shoppingcentre_ga`"
I just managed to resolve the issue. The problem was the names of the tables in the foreign key assignments.. Thanks to everyone for your help

Tim Holloway wrote:Sorry, I was looking at stale docs. One thing, though. I really don't recommend using upper-case letters in SQL column and table names. Different databases react differently and it can be pretty messy. MySQL is very strict  and lots of MySQL databases do have mixed-case names, but as I said, it's not something I recommend.

Anyway, let me see if I can take a stab:


I made the lines shorter so that they would fit in a non-scrolled browser window. But note that I put the check constraints with their column definitions and not as appended clauses. Makes the syntax simpler and reduces confusion about what's being done where.



I get the following error code when i use the recommended code "MySQL said: Documentation

#1005 - Can't create table `shopping_centres`.`shoppingcentreshop` (errno: 150 "Foreign key constraint is incorrectly formed")"

Tim Holloway wrote:You explicitly coded the invalid keyword CONSTRAINT in your DDL. MySQL doesn't need or want that word there. It already knows what a constraint is. So not:


But simply


It was thinking you were attempting to define a column named "CONSTRAINT". Badly.


i tried erasing the CONSTRAINT and i get an error code of "Unrecognized data type near CHECK"


i have the following code i try to execute



and i get the following error codes

   “A symbol name was expected! A reserved keyword can not be used as a column name without backquotes. (near "CHECK" at position 147)
   Unexpected beginning of statement. (near "Category" at position 155)
   Unrecognized statement type. (near "in" at position 164)

the error appears on the bold line of code " I am a beginner in MySQL so any help would be greatly appreciated

i also get the following error line "#1005 - Can't create table shopping_centres.shoppingcentreshop (errno: 150 "Foreign key constraint is incorrectly formed") (Details…)"
I am a complete beginner so any help is much appreciated. i am using mariadb version 10.4.11

Knute Snortum wrote:You don't need to return anything from your setXxx() methods, but they seem to be setting the fields just fine.  Now how are you using the Review class to pass the data?  Do you have getReviewer() and getRating() methods?


yes here they are

6 months ago

Knute Snortum wrote:I think we're going to need to see more code from Review, specifically setRatings() and setReviewer();


6 months ago

Carey Brown wrote:If you want a single file then use a single printWriter.

BTW, you are starting WAY too many topics for the same project and, like this post, unless you've looked at the others you've got no context. PLEASE stop creating new topics for this project.


i managed to add the variables from the second class however they get printed with default values
for instance my reviewer object gets printed "TBC" instead of John as was the input.. my rating object gets printed 0 instead of 3 as i set it

the following bit  of code sets them as they were printed which means that the problem is when i try to input the values the variables get no input

here is my code where i'm trying to input the values
6 months ago

Carey Brown wrote:If you want a single file then use a single printWriter.

BTW, you are starting WAY too many topics for the same project and, like this post, unless you've looked at the others you've got no context. PLEASE stop creating new topics for this project.


how do i add the second class within the same print object? sorry i wont create any more topics this is my last problem
6 months ago
i want to be able to write to a text file variables from two different classes

I have a toString (delimiter) method that accepts input from the first class and i need a way to accept input from the second class as well.. i have printWriter printing the toString(delimiter) method
6 months ago

Norm Radder wrote:

Exception in thread "main" java.lang.NullPointerException


What variable in the line with the exception has the null value?  Add a print statement just before that line that prints out the values of all the variables used on that line.  The print out will show which is null.


even though i tried to input values to the variables as seen below
6 months ago

Norm Radder wrote:

Exception in thread "main" java.lang.NullPointerException


What variable in the line with the exception has the null value?  Add a print statement just before that line that prints out the values of all the variables used on that line.  The print out will show which is null.


all four of the variables return null
6 months ago
i try to run the following code and i get a "Exception in thread "main" java.lang.NullPointerException
at model.Restaurant.toString(Restaurant.java:7)"
on line
my code is as follows
6 months ago

Liutauras Vilda wrote:I have replicated your scenario on my machine, all compiles.

But you have other problems, such as line 35. Check what's wrong with that.


whats the problem with that line?
6 months ago