You are not logged in.

birosys

Trainee

  • "birosys" is male
  • "birosys" started this thread

Posts: 48

Date of registration: Feb 9th 2009

Location: Mladenovac, Serbia

Occupation: Programming

Hobbies: Programming

  • Send private message

1

Monday, February 9th 2009, 2:29am

FireBird JDBC Connection

Hello to all!

I need a little help
I am trying to connect a FireBird database, but i got error:
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at sun.misc.Launcher$ExtClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 32 more

What to do?

Sorry for my poor english :S

Thanks!
Milan

birosys

Trainee

  • "birosys" is male
  • "birosys" started this thread

Posts: 48

Date of registration: Feb 9th 2009

Location: Mladenovac, Serbia

Occupation: Programming

Hobbies: Programming

  • Send private message

2

Monday, February 9th 2009, 1:49pm

FireBird JDBC Connection Working Example

Hi, there is working example with Jabaco & FireBird.
Download JayBird from http://www.firebirdsql.org/index.php?op=devel&sub=jdbc and add to your Project->References
file jaybird-full-2.1.6.jar
Here is code:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Public Sub Command1_Click()
   Dim con As Class
   Dim i As Integer
   Dim rs As ResultSet 
   Dim noc As Long
   Dim Rows As Long
   con=class.forName("org.firebirdsql.jdbc.FBDriver")
   If con=Nothing Then
  	msgbox "Driver is not installed!"
   Else
  	msgbox "Driver is installed!"
   End If
   Database1.Connect ("jdbc:firebirdsql:localhost/3050:/Program Files/Firebird/Firebird_2_1/examples/empbuild/EMPLOYEE.FDB", "sysdba", "masterkey")
   rs = Database1.ExecuteStatement ("Select * from customer")
   noc=rs.getMetaData.getColumnCount 
   msgbox "Number of columns: "+noc
   jbgrid1.Cols=noc
   For i=1 To noc
  	JBGrid1.Header(i-1)=rs.getMetaData.getColumnName(i)
   Next i
   Do While rs.next
  	For i=1 To noc
     	JBGrid1.TextMatrix(rs.getRow()-1,i-1)=rs.getString(i)
  	Next i
  	Rows=Rows+1
  	jbgrid1.Rows=rows
   Loop
End Sub


Have fun

Milan

Rate this thread
WoltLab Burning Board