connecting to Firebird database
rramirez Jul 28, 2002 6:02 PMI'm trying to connect to a firebird database and I'm getting the following exception:
13:37:48,676 INFO [FBManagedConnectionFactory] Could not get a db connection!
org.firebirdsql.gds.GDSException:
at org.firebirdsql.jgds.GDS_Impl.connect(GDS_Impl.java:1240)
at org.firebirdsql.jgds.GDS_Impl.isc_attach_database(GDS_Impl.java:263)
at org.firebirdsql.jgds.GDS_Impl.isc_attach_database(GDS_Impl.java:247)
at org.firebirdsql.jca.FBManagedConnectionFactory.createDbHandle(FBManagedConnectionFactory.java:515)
at org.firebirdsql.jca.FBManagedConnectionFactory.assureDbHandle(FBManagedConnectionFactory.java:524)
at org.firebirdsql.jca.FBManagedConnection.(FBManagedConnection.java:111)
....
at org.jboss.Main.boot(Main.java:142)
at org.jboss.Main$1.run(Main.java:375)
at java.lang.Thread.run(Thread.java:479)
13:37:48,786 INFO [EjbModule] Remove JSR-77 EJB Module: jboss.management.single:J2EEApplication= ,J2EEServer=Single,j2eeType=EJBModule,name=andrea.jar
13:37:48,796 ERROR [EjbModule] Initialization failed
org.jboss.deployment.DeploymentException: Error while fixing table name; - nested throwable: (java.sql.SQLException: Problem getting connection: javax.resource.ResourceException: could not get a db co
nnection!)
at org.jboss.ejb.plugins.cmp.jdbc.SQLUtil.fixTableName(SQLUtil.java:67)
at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.(JDBCEntityBridge.java:103)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.create(JDBCStoreManager.java:332)
at org.jboss.ejb.plugins.CMPPersistenceManager.create(CMPPersistenceManager.java:155)
....
I'm using jboss-3.0.0.
The following is what I have done to try to get this working.
I placed the firebirdsql.rar file in the /jboss/server/default/deploy directory.
I edited the firebird-service.xml file and placed it in the deploy directory.
I can connect to the Firebird database using the firebirdsql.jar file without using jboss.
Here are the configuration files:
-------------------------- ejb-jar.xml -------------------
<?xml version="1.0"?>
<ejb-jar>
<enterprise-beans>
The Account Bean that handles the account information
<ejb-name>AccountEJB</ejb-name>
com.andrea.server.impl.AccountHomeRemote
com.andrea.server.impl.AccountRemote
<ejb-class>com.andrea.server.impl.AccountBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Long</prim-key-class>
False
<cmp-version>2.x</cmp-version>
<abstract-schema-name>AccountSchema</abstract-schema-name>
<cmp-field><field-name>accountId</field-name></cmp-field>
<cmp-field><field-name>email</field-name></cmp-field>
<cmp-field><field-name>passcode</field-name></cmp-field>
<cmp-field><field-name>phrase</field-name></cmp-field>
<cmp-field><field-name>phraseResponse</field-name></cmp-field>
<cmp-field><field-name>name</field-name></cmp-field>
<primkey-field>accountId</primkey-field>
</enterprise-beans>
<assembly-descriptor>
<security-role>
This role represents everyone who is allowed full access
to the Account EJB.
<role-name>everyone</role-name>
</security-role>
<method-permission>
<role-name>everyone</role-name>
<ejb-name>AccountEJB</ejb-name>
<method-name>*</method-name>
</method-permission>
<container-transaction>
<ejb-name>AccountEJB</ejb-name>
<method-name>*</method-name>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
-------------------------- ejb-jar.xml --------------------------
-------------------------- jboss.xml --------------------------
<?xml version="1.0" encoding="Cp1252"?>
<enterprise-beans>
<ejb-name>AccountEJB</ejb-name>
<jndi-name>AccountHomeRemote</jndi-name>
</enterprise-beans>
-------------------------- jboss.xml --------------------
----------- jbosscmp-jdbc.xml -----------
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
<!-- -->
<!-- Standard JBossCMP-JDBC Configuration -->
<!-- -->
<!-- ===================================================================== -->
<jbosscmp-jdbc>
java:/AndreaDS
<datasource-mapping>InterBase</datasource-mapping>
<create-table>false</create-table>
<remove-table>false</remove-table>
<read-only>false</read-only>
<pk-constraint>true</pk-constraint>
<preferred-relation-mapping>foreign-key</preferred-relation-mapping>
<enterprise-beans>
<ejb-name>AccountEJB</ejb-name>
<table-name>account</table-name>
<cmp-field>
<field-name>accountId</field-name>
<column-name>accountId</column-name>
<jdbc-type>BIGINT</jdbc-type>
<sql-type>NUMERIC(12,0)</sql-type>
</cmp-field>
<cmp-field>
<field-name>email</field-name>
<column-name>email</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(80)</sql-type>
</cmp-field>
<cmp-field>
<field-name>passcode</field-name>
<column-name>passcode</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(40)</sql-type>
</cmp-field>
<cmp-field>
<field-name>phrase</field-name>
<column-name>phrase</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(200)</sql-type>
</cmp-field>
<cmp-field>
<field-name>phraseResponse</field-name>
<column-name>phraseResponse</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(100)</sql-type>
</cmp-field>
<cmp-field>
<field-name>name</field-name>
<column-name>name</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(80)</sql-type>
</cmp-field>
</enterprise-beans>
</jbosscmp-jdbc>
-------------------------- jbosscmp-jdbc.xml -------------
-------------------------- firebird-service.xml ------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- ==================================================================== -->
<!-- New ConnectionManager setup for firebird dbs using jca-jdbc xa driver-->
<!-- Build jmx-api (build/build.sh all) and view for config documentation -->
<!-- ==================================================================== -->
<!--FBManager can be used to create and drop databases.
Drop is especially useful during testing, since it
assures a clean start next time. -->
H:/jboss-3.0.0/server/default/db/andrea.gdb
sysdba
masterkey
false
false
<!--make the rar deploy - A BIG HACK till xslt based deployment is written-->
jboss.jca:service=RARDeployer
<depends optional-attribute-name="ManagedConnectionFactoryName">
<!--more hack-->
<depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=Firebird Database Connector
<!--config-property>
<config-property-name>Server</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>localhost</config-property-value>
</config-property>
<config-property>
<config-property-name>Port</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
<config-property-value>3050</config-property-value>
</config-property-->
<config-property>
<config-property-name>Database</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>H:/jboss-3.0.0/server/default/db/andrea.gdb</config-property-value>
</config-property>
<config-property>
<config-property-name>UserName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>sysdba</config-property-value>
</config-property>
<config-property>
<config-property-name>Password</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>masterkey</config-property-value>
</config-property>
AndreaDS
<depends optional-attribute-name="ManagedConnectionPool">
5
50
5000
15
<!--criteria indicates if Subject (from security domain) or app supplied
parameters (such as from getConnection(user, pw)) are used to distinguish
connections in the pool. Choices are
ByContainerAndApplication (use both),
ByContainer (use Subject),
ByApplication (use app supplied params only),
ByNothing (all connections are equivalent, usually if adapter supports
reauthentication)-->
ByContainer
<depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager
<!-- Include a login module configuration named FirebirdDBRealm.
Update your login-conf.xml, here is an example for a
ConfiguredIdentityLoginModule:
<application-policy name = "FirebirdDBRealm">
<login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
<module-option name = "principal">sysdba</module-option>
<module-option name = "userName">sysdba</module-option>
<module-option name = "password">masterkey</module-option>
<module-option name = "managedConnectionFactoryName">jboss.jca:service=XaTxCM,name=AndreaDS</module-option>
</login-module>
</application-policy>
NOTE: the application-policy name attribute must match SecurityDomainJndiName, and the
module-option name = "managedConnectionFactoryName"
must match the object name of the ConnectionManager you are configuring here.
-->
<!--comment out this line if you want component managed security or want
to use the default values in the ManagedConnectionFactoryProperties -->
<!--
FirebirdDBRealm
-->
<depends optional-attribute-name="JaasSecurityManagerService">jboss.security:name=JaasSecurityManager
java:/TransactionManager
------------- firebird-service.xml -------------
Any help would be greatly appreaciated.
I'm using jboss 3.0, JDK 1.3.1_03-b03 and Firebird 1.0
Thanks,
Ruben