NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
jlangton
Joined: 26 Jan 2011 Posts: 4
|
Posted: Mon May 07, 2012 5:51 pm Post subject: layer.xml entry for DatabaseConnection |
|
|
Hi, I'm just trying to specify a connection in the layer.xml file for a module such that a default DatabaseConnection will appear in DatabaseExplorer. I've read this can be done and am using this guide:
http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-db/architecture-summary.html
However, it's not working. Can anyone advise? Here's what I'm trying right now:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
<filesystem>
<folder name="Databases">
<folder name="Explorer">
<folder name="Connection">
<driver-class value='org.postgresql.Driver'/>
<driver-name value='postgres'/>
<database-url value='jdbc:postgresql://127.0.0.1:5432'/>
<schema value='public'/>
<user value='postgres'/>
</folder>
</folder>
</folder>
</filesystem> |
|
| Back to top |
|
 |
Javier Ortiz Posted via mailing list.
|
Posted: Mon May 07, 2012 8:54 pm Post subject: [platform-dev] Re: layer.xml entry for DatabaseConnection |
|
|
I prefer doing it from code:
try {
conn = DatabaseConnection.create(findSqlServerDriver("org.h2.Driver", "H2"),
dbProperties.get(PersistenceUnitProperties.JDBC_URL),
dbProperties.get(PersistenceUnitProperties.JDBC_USER),
"card_manager",
dbProperties.get(PersistenceUnitProperties.JDBC_PASSWORD),
true,
"Deck Manager Database");
//Create the default connection to embedded database
ConnectionManager.getDefault().addConnection(conn);
LOG.log(Level.FINE, "Created default connection!");
} catch (DatabaseException ex) {
LOG.log(Level.SEVERE, null, ex);
}
findSqlServerDriver gets returns JDBCDriver. Just replace the values as you need.
You can check the available connections using ConnectionManager.getDefault().getConnections() and compare the ones available.
Senior Software Quality Engineer
ArthroCare Corporation
7000 William Cannon Drive
Austin, TX 78735
Phone: 512-358-5996
email: address-removed
-----Original Message-----
From: jlangton [mailto:address-removed]
Sent: Monday, May 07, 2012 12:51 PM
To: address-removed
Subject: [platform-dev] layer.xml entry for DatabaseConnection
Hi, I'm just trying to specify a connection in the layer.xml file for a module such that a default DatabaseConnection will appear in DatabaseExplorer. I've read this can be done and am using this guide:
http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-db/architecture-summary.html
However, it's not working. Can anyone advise? Here's what I'm trying right now:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
<filesystem>
<folder name="Databases">
<folder name="Explorer">
<folder name="Connection">
<driver-class value='org.postgresql.Driver'/>
<driver-name value='postgres'/>
<database-url value='jdbc:postgresql://127.0.0.1:5432'/>
<schema value='public'/>
<user value='postgres'/>
</folder>
</folder>
</folder>
</filesystem>
**********
The information contained in this e-mail message, together with any
attachments thereto, is intended only for the personal and confidential
use of the addressee named above. The message and the attachments
are or may be privileged or protected communication. If you are not the
intended recipient of this message, or authorized to receive it for the
intended recipient, you have received this message in error, and you
are not to review, use, disseminate, distribute or copy this message,
any attachments thereto, or their contents. If you have received this
message in error, please immediately notify us by return e-mail
message, and delete the original message.
Pursuant to Circular 230 issued by the United States Treasury
Department and relating to practice before the Internal Revenue
Services, any comment or opinion in this communication relating to a
federal tax issue is not intended to be used, and cannot be used, by a
taxpayer for the purpose of avoiding tax-related penalties that may be
imposed on the taxpayer. |
|
| Back to top |
|
 |
akochnev
Joined: 29 Sep 2010 Posts: 62
|
Posted: Mon May 07, 2012 9:13 pm Post subject: [platform-dev] Re: layer.xml entry for DatabaseConnection |
|
|
John,
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|