Subject | Re: [Firebird-Java] Firebird with Jaybird |
---|---|
Author | LEANDRO (YAHOO) |
Post date | 2004-09-14T10:23:29Z |
to conect...
public class AristarcusDatabase extends Database
{
final static String jdbcDriver = "org.firebirdsql.jdbc.FBDriver";
final static String jdbcProtocolPrefix = "jdbc:firebirdsql://";
final static String dbName = "localhost/C:/OP2/OP7/Aristarcus.GDB";
public AristarcusDatabase(String user, String passwd)
throws PersistenceException
{
super(jdbcDriver, jdbcProtocolPrefix + dbName, "SYSDBA", "masterkey");
registerPersister(Author.class, new AuthorPersister());
registerPersister(Paper.class, new PaperPersister());
//registre os demais persisters
}
to insert...
synchronized public void insert(Transaction t, Persistent p)
throws PersistenceException
{
try
{
Database db = (Database)t.getObjectStore();
Author author = (Author)p;
String sqlQuery = ("INSERT INTO AUTHOR("+
"AuthorId, PersistentId, Formation, Name, Email, RG, CPF)" +
" VALUES (" + author.getId() + "," +
author.getId() + ",'" +
author.getFormation() + "','" +
author.getName() + "','" +
author.getEmail() + "','" +
author.getRG() + "','" +
author.getCPF() + "')");
db.executeQuery(sqlQuery);
thanks...
LEANDRO
public class AristarcusDatabase extends Database
{
final static String jdbcDriver = "org.firebirdsql.jdbc.FBDriver";
final static String jdbcProtocolPrefix = "jdbc:firebirdsql://";
final static String dbName = "localhost/C:/OP2/OP7/Aristarcus.GDB";
public AristarcusDatabase(String user, String passwd)
throws PersistenceException
{
super(jdbcDriver, jdbcProtocolPrefix + dbName, "SYSDBA", "masterkey");
registerPersister(Author.class, new AuthorPersister());
registerPersister(Paper.class, new PaperPersister());
//registre os demais persisters
}
to insert...
synchronized public void insert(Transaction t, Persistent p)
throws PersistenceException
{
try
{
Database db = (Database)t.getObjectStore();
Author author = (Author)p;
String sqlQuery = ("INSERT INTO AUTHOR("+
"AuthorId, PersistentId, Formation, Name, Email, RG, CPF)" +
" VALUES (" + author.getId() + "," +
author.getId() + ",'" +
author.getFormation() + "','" +
author.getName() + "','" +
author.getEmail() + "','" +
author.getRG() + "','" +
author.getCPF() + "')");
db.executeQuery(sqlQuery);
thanks...
LEANDRO
> > I try to use Firebird and JDBC Jaybird to access a GDB file, butfull
> > when I try to insert a data in GDB I give a message:
> >
> > Resource Exception. Unrecognized transaction
> > Reason: Unrecognized transaction
> >
> > How can I resolv this??
>
> Should not happen in normal case. Please post the code you use and the
> stack trace.
>
> Roman