Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

ERROR: invalid input syntax for type time: “128" - JDBC, Java, PSQL

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For some reason when trying to insert some values into a table from a file a syntax error occurs called
"ERROR: invalid input syntax for type time: “128"”, it says line 128, but the thing is line 128 shows - '126 - catch (Exception e) {
127 - e.printStackTrace();
128 - }
129 - return numRows;

So I am confused as to why that is the case, I am not sure if my created table with the time values was in the wrong syntax or what, it’s confusing to figure out. Also I am using PSQL.



 
Marshal
Posts: 3760
536
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know if this is part of your problem, but the code you have posted contains stylized quotes (smart quotes) rather than "straight quotes".  This is often due to using a word processor rather than a text editor to enter/edit your code.

Try cleaning those up and see if the problem goes away.
 
Wilson Lane
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:I don't know if this is part of your problem, but the code you have posted contains stylized quotes (smart quotes) rather than "straight quotes".  This is often due to using a word processor rather than a text editor to enter/edit your code.

Try cleaning those up and see if the problem goes away.



I'll check and come back to you.
 
Wilson Lane
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:I don't know if this is part of your problem, but the code you have posted contains stylized quotes (smart quotes) rather than "straight quotes".  This is often due to using a word processor rather than a text editor to enter/edit your code.

Try cleaning those up and see if the problem goes away.



That doesn't change anything sorry.  the smart quotes only occur on this website, not in my actual code.
 
Wilson Lane
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's the full code for some context -

 
Saloon Keeper
Posts: 24868
174
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it's actually saying that you fed a value of "128" to a column of type Time, not that line 128 was the problem.

Also, it's really not a good idea to hard-code your IDE's directory path into the code.
 
Wilson Lane
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:I think it's actually saying that you fed a value of "128" to a column of type Time, not that line 128 was the problem.

Also, it's really not a good idea to hard-code your IDE's directory path into the code.



You're correct.
reply
    Bookmark Topic Watch Topic
  • New Topic