Subject | jay bird jdbc error |
---|---|
Author | SRINIVASAN |
Post date | 2006-11-29T16:35:29Z |
Hi,
I am using netbean IDE, I add following jar in library jaybird-full-2.1.0.jar. Here is my code and error. kindly helo me to solve this problem. there is no compile error. error given at execution.
CODE:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import org.firebirdsql.management.FBManager;
import org.firebirdsql.jdbc.FBDriver;
import org.firebirdsql.*;
import java.lang.*;
import java.io.*;
import java.sql.*;
/**
*
* @author srini
*/
public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws Exception {
// TODO code application logic here
FBManager fbManager = new FBManager();
String DB_SERVER_URL = "localhost";
int DB_SERVER_PORT = 3050;
String DB_PATH = "c:/database";
String DB_NAME = "test.fdb";
String DB_USER = "sysdba";
String DB_PASSWORD = "masterkey";
fbManager.setServer(DB_SERVER_URL);
//fbManager.setPort(DB_SERVER_PORT);
fbManager.start();
//fbManager.createDatabase(DB_PATH + "/" + DB_NAME, DB_USER, DB_PASSWORD);
fbManager.createDatabase("C:/fireb4.fdb","SYSDBA","masterkey");
try {
Class.forName("org.firebirdsql.jdbc.FBDriver").newInstance();
System.out.println(" Drivere is---- "+Class.forName("org.firebirdsql.jdbc.FBDriver"));
// DriverManager.getConnection("jdbc:firebirdsql:\\localhost:C:\\fireb3.fdb user 'sysdba' password 'masterkey'");
//Connection conn = DriverManager.getConnection("jdbc:firebirdsql://10.20.0.4/fireb.fbd","SYSDBA","masterkey");
Connection conn =DriverManager.getConnection("jdbc:firebirdsql:localhost:C:\\fireb3.fdb user 'sysdba' password 'masterkey'");
} catch (Exception rr){
rr.printStackTrace();
}
}
}
ERROR :
java.lang.NullPointerException
at org.firebirdsql.gds.impl.wire.ParameterBufferBase$StringArgument.getLength(ParameterBufferBase.java:223)
at org.firebirdsql.gds.impl.wire.ParameterBufferBase.getLength(ParameterBufferBase.java:117)
at org.firebirdsql.gds.impl.wire.XdrOutputStream.writeTyped(XdrOutputStream.java:192)
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.internalAttachDatabase(AbstractJavaGDSImpl.java:407)
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.iscAttachDatabase(AbstractJavaGDSImpl.java:370)
at org.firebirdsql.jca.FBManagedConnection.<init>(FBManagedConnection.java:89)
at org.firebirdsql.jca.FBManagedConnectionFactory.createManagedConnection(FBManagedConnectionFactory.java:470)
at org.firebirdsql.jca.FBStandAloneConnectionManager.allocateConnection(FBStandAloneConnectionManager.java:69)
at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:119)
at org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:131)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:193)
at exmp2.Main.main(Main.java:60)
[Non-text portions of this message have been removed]