I have created a set of SQL queries that modify a database, and now I want to test them.
How can I create a local and temporary PostgreSQL database to test my queries. I'm working in Java.
I have created a set of SQL queries that modify a database, and now I want to test them. How can I create a local and temporary PostgreSQL database to test my queries. I'm working in Java. |
|||||||||
|
Creating a database is simple enough once your database cluster is in place.
The database will be created and you can connect to it now. Of course you need to have the necessary privileges to create a database. |
|||
|
You CAN create and drop PostgreSQL db's via Java using the Statement object. Kanwarbrar's answer is incorrect and not to the point (but I cannot downvote yet). Example:
See the following link for a good starting point: http://www.jvmhost.com/articles/create-drop-databases-dynamically-java-jsp-code |
|||||||||||||
|
You can see her how to create database Hope this help
http://www.tutorialspoint.com/jdbc/jdbc-create-database.htm You must connect first to the localhost
|
|||||||||||||
|
Your question is little bit wrong,with Java code you cannot create a database,you can just connect to a database. First of all you need to create a database in PgAdminIII. Here is the code which will help you to create table in postgresql database through JAVA
For complete reference:http://kodingpoint.blogspot.in/2014/01/java-postgresql-connectivity-example.html |
|||
|