• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Creating A Simple Database in Postgresql  RSS feed

 
Greenhorn
Posts: 3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! I am trying to create a table in postgresql but when I check my database using pgAdmin, the Table isn't there. I have done a simple postgresql connection java application, so, I know that I can connect to my database. And, I know where to place my postgresql connector jar.  I am quite new to database programming, so, please patient with me. Thanks! Here is my servlet init code:

 
Bartender
Posts: 2038
273
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you have pgAdmin, it probably easier to troubleshoot/verify there using SQL Editor rather than in servlet code.

The DDL in your post looks like it is incomplete - are there supposed to be more columns?  If there that's all there is, then try replacing the last comma with a closing paren.
 
Ron McLeod
Bartender
Posts: 2038
273
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.. and Welcome to the Ranch
 
Aedric Serio
Greenhorn
Posts: 3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:Since you have pgAdmin, it probably easier to troubleshoot/verify there using SQL Editor rather than in servlet code.

The DDL in your post looks like it is incomplete - are there supposed to be more columns?  If there that's all there is, then try replacing the last comma with a closing paren.




You are right! I didn't see that last time.    It is working now. I guess I should use SQL Editor first before I put it into a java code. Thank you all for the tips! 
 
Bartender
Posts: 19733
92
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code will leak database resources when exceptions are thrown.
 
Aedric Serio
Greenhorn
Posts: 3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:Your code will leak database resources when exceptions are thrown.




You mean the e.printStackTrace(); I used for the catch block. I've read something like that before but I couldn't remember all the details. I think I should replace it with another more secure error logging, I am not sure. Thanks for reminding me. Currently, I running and testing my codes in eclipse. I also have a question about deregistering jdbc, isn't that the same as a closing connection?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!