I found this template in RC file setup for HSQLDB.
Template for a Postgresql database
urlid blainedb
url jdbc:postgresql://idun.africawork.org/blainedb
username blaine
password losung1
driver org.postgresql.Driver
Is it possible to connect to a postgres database residing on a different server?
I have included the postgres jdbc driver in C:\Program Files\java\jdk 1.6\lib folder and i specified the path in CLASSPATH variable.
Please let me know how to make a connection to a postgres database through HSQLDB. Any specifications need to specify.. like HSQLDB server engine or any other?
Related
I am looking for a way to connect my Next.js application with Azure Database for PostgreSQL server. Prisma seems to work well with Next.js but I can't figure connection string or if it is even supported database.
Example:
DATABASE_URL = 'postgresql://johndoe:randompassword#localhost:5432/mydb?schema=public'
The host I am trying to connect to:
posgreservertest.postgres.database.azure.com:5432
So it should be something like "...#posgreservertest.postgres.database.azure.com:5432/mydb?".
I am trying to npx prisma introspect and this is how my cmd looks like:
PS C:\Web stuff\nextjs\test> npx prisma introspect
Environment variables loaded from prisma\.env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "posgreservertest.postgres.database.azure.com:5432"
Introspecting based on datasource defined in prisma\schema.prisma …
Error: P1001
Can't reach database server at posgreservertest.postgres.database.azure.com:`5432`
Please make sure your database server is running at posgreservertest.postgres.database.azure.com:`5432`.
Is it even possible to connect to Connect to Azure Database for PostgreSQL server with Prisma as it doesn't feature this option in their supported databases?
Make sure you've set your database as publicly available.
Add a firewall rule to allow connections from your IP. If you aren't concerned much about security you can allow connections from any IP. Just set 0.0.0.0-255.255.255.255 rule.
Ensure that you are using the full username id. For Azure PostgreSQL server id consists of two parts <username>#<servername>. In your following example full connection string will look like this
postgresql://username#servername:password#servername.postgres.database.azure.com:5432/dbname?your=options
If you've set SSL enforcing on your server make sure to add sslmode=require option
Has anyone had any luck or found documentation on how to add IBM Db2 as a datasource for their dashboard on Apache Superset? I don't see any information in the Db2 service credentials about the driver or dialect.
Based on the docs for Apache Superset the connections and hence the connection URI are based on SQLAlchemy. According to the Db2 driver for SQLAlchemy, the Db2 database URI would be like this:
db2+ibm_db://user:pass#host[:port]/database
db2+ibm_db is the dialect and driver, database is the database name on that host with the specified port (typically 50000). If you want to connect to a local database, just leave out the host/port combination:
db2+ibm_db://user:pass#/database
I have a machine with a local system DSN configured.
This connection points to a PostgreSQL database.
This works well (BO is using it)
Can I use this existing local DSN to connect dbeaver to this PostgreSQL Database?
I do not know the password of the database, hence my hope of using the already configured and working DSN.
Could not solve this, used PostgreSQL drivers
I am using the script of the spring.io/spring-roo/#running-from-shell fast guide, a 10 lines example.
The only modification is the jpa setup --provider line, changed to connect PostgreSQL (HIBERNATE --database POSTGRES). All the steps and code are at this roo_hello2pg.md github document.
The application.properties seems
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc\:postgresql\://localhost\:5432/hello2bd
spring.datasource.username=postgres
spring.datasource.password=postgres
What more I need? Some spring.jpa.hibernate lines? The browser generates error "status=500" when use database (insert a value).
As I could see in your gitHub repository, you have configured your connection to the Postgres database correctly.
But did you create the hello2db database and the Timer table in your system?
As the Spring Boot documentation sais, JPA databases will be automatically created only if you use an embedded database (H2, HSQL or Derby)
Check http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-creating-and-dropping-jpa-databases
In your case, to create the database automatically using a Postgres DB, you should include the spring.jpa.hibernate.ddl-auto=create-drop property in the application.properties file.
Hope it helps,
I'm currently upgrading a project from Java 7 to Java 8, thus I switched from using the JDBC-ODBC Bridge to using UCanAccess. The database I want to connect to is registered as a system DSN so I connected to it like this:
Database.forURL("jdbc:odbc:MyDB" + ";DB_CLOSE_DELAY=-1;charSet=Cp1250", driver = "sun.jdbc.odbc.JdbcOdbcDriver")
Now I changed that to
Database.forURL("jdbc:ucanaccess:MyDB" + ";DB_CLOSE_DELAY=-1;charSet=Cp1250", driver = "net.ucanaccess.jdbc.UcanaccessDriver")
but that gives me the error:
Driver net.ucanaccess.jdbc.UcanaccessDriver does not know how to handle URL jdbc:ucanaccess:MyDB;DB_CLOSE_DELAY=-1;charSet=Cp1250
Is there a way to access a DSN via UCanAccess?
Is there a way to access a DSN via UCanAccess?
Not directly. UCanAccess is a JDBC driver that does not use ODBC, so it has no knowledge of ODBC DSNs.
Your UCanAccess connection string needs to include the path to the Access database file, e.g.,
jdbc:ucanaccess://C:/path/to/mydata.accdb
If necessary, you could retrieve that file path from the configuration information for an ODBC DSN. On Windows, the information for a System DSN named MyDB would be in the Windows registry under
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\MyDb
or perhaps
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\MyDb