Win a copy of Spring in Action (5th edition) this week in the Spring 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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:

 
Saloon Keeper
Posts: 2150
278
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
Saloon Keeper
Posts: 2150
278
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: 19976
95
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?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!