JDBC :: How To Add Database To NetBeans Project When Making Setup
Aug 21, 2014
I have completed an assignment for my university in which I had to make a Java NetBeans project. My project is now completed but now I have to make a setup of my NetBeans project and give the university the setup file, only.
My question is, the software I made has a database attached to it, meaning the purpose of the software is to be used with the database. Values must be saved in the database, deleted from the database etc.. I have used MySQL database connections with the JDBC driver
I have used exe4j to make the .exe file and Setup Factory to make the exe file and setup file respectively. Once I make the setup and run the setup, the application works, ON MY COMPUTER. The computer which made the software. But once I take it to a computer in which MySQL was not installed, the setup installed, but the software did not work.
View Replies
ADVERTISEMENT
Aug 21, 2014
I have completed an assignment for my university in which I had to make a Java NetBeans project. My project is now completed but now I have to make a setup of my NetBeans project and give the university the setup file, only.
My question is, the software I made has a database attached to it, meaning the purpose of the software is to be used with the database. Values must be saved in the database, deleted from the database etc.. I have used MySQL database connections with the JDBC driver
I have used exe4j to make the .exe file and Setup Factory to make the exe file and setup file respectively. Once I make the setup and run the setup, the application works, ON MY COMPUTER. The computer which made the software. But once I take it to a computer in which MySQL was not installed, the setup installed, but the software did not work.
View Replies
View Related
Apr 12, 2014
i downloaded a sample database code of an online payroll system. How can i assemble it to know how it works.
the files include php and mysql files. it is to build an online payroll system
View Replies
View Related
Mar 26, 2014
First I was using this way how to get connection and all was fine.
con = DriverManager.getConnection("jdbc:derby:memory:datab;create=true");
But now I have to change it to DataSource and how I find out derby had class ClientDataSource for this but for the hell I can't find out how to setup that virtual DB.
ClientDataSource ds = new ClientDataSource();
con = ds.getConnection();
View Replies
View Related
Nov 9, 2014
I want to bundle some images and sounds with my project, that is, I want to put these images (png) into the jar and be able to access them inside my project.
View Replies
View Related
May 10, 2014
I am suppose to submit my project as a WAR file but not sure how to do it.
View Replies
View Related
May 2, 2014
I have a project of biometric integration by java and i have that javaApi with me for that project i need to add native libraries through NetBeansIDE7.4. I am trying like this
Right click on the ProjectSelect PropertiesClick on RUNIn VM Options TYPE
-Djava.library.path="D:/bio-metric/SBXPC_CORE_130330/SBXPCJavaProxy.dll"
press Ok but still I am getting Exception
java.lang.UnsatisfiedLinkError: no SBXPCJavaProxy in java.library.path
View Replies
View Related
Nov 25, 2014
I wish to retrieve just one value from db;
so I use this code:
@Transactional
public long getSequenceSedeB(Long id) {
BigDecimal seqValue = nu
String sql = "SELECT MAX(ID) FROM SEDE_B_ALLEGATI_A WHERE ID_SEDE=:id";
SQLQuery query = getSession().createSQLQuery(sql);
[Code] ....
But it do not works; this is the log.
type.NullableType (NullableType.java:182) - could not read column value from result set: ID; Invalid column name
2014-11-25 14:45:14,476 WARN [btpool0-2] util.JDBCExceptionReporter (JDBCExceptionReporter.java:77) - SQL Error: 17006, SQLState: null
2014-11-25 14:45:14,478 ERROR [btpool0-2] util.JDBCExceptionReporter (JDBCExceptionReporter.java:78) - Invalid column name
But in the database the query
SELECT MAX(ID) FROM SEDE_B_ALLEGATI_A WHERE ID_SEDE=:id
run correctly;
Also I need to rewrite the statement
query.setParameter("id", 923);
in this way
query.setParameter("id", AAA);
where AAA is gotten from out of the procedure;
View Replies
View Related
Feb 26, 2015
I'm having problem with my code when it comes to Restore Database in Java. This is my code:
public boolean restoreDB(String dbUserName, String dbPassword, String source) {
String[] executeCmd = new String[]{"C:Program Files (x86)MySQLMySQL Server 5.1inmysqldump ", "--user=" + "root", "--password=" + "1234" + source};
Process runtimeProcess;
try {
runtimeProcess = Runtime.getRuntime().exec(executeCmd);
int processComplete = runtimeProcess.waitFor();
[Code] ....
View Replies
View Related
Apr 24, 2014
I created a database in mysql, but I have problems communicating with the DB in java.
Here is the error :
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/books
at java.sql.DriverManager.getConnection(DriverManager.java:604)
at java.sql.DriverManager.getConnection(DriverManager.java:221)
at displayauthors.DisplayAuthors.main(DisplayAuthors.java:30)
java.lang.NullPointerException
[Code] ....
HERE IS THE CODE
public class DisplayAuthors {
// database URL
static final String DATABASE_URL = "jdbc:mysql://localhost:3306/books";
// launch the application
public static void main( String args[] )
[Code] ....
View Replies
View Related
Mar 13, 2015
This question is not about syntax but a best way to handle something. What is the best way to store a image into a database? For example converting it into binary etc. I just wanted to get some opinions.
View Replies
View Related
Aug 27, 2014
I have a problem where i cant seem to get this simple delete command working. Everytime i run it it just locks the database and crashes
The id parameter exists in the database the database is small. Only a few tables. update commands work completely fine.
The id is an in and resulting command is - DELETE from Employees where ID = 2;
public static void EmployeeDeleteByID(int idIn){
Connection c = null;
Statement stmt = null;
try {
c = Connect();
c.setAutoCommit(false);
System.out.println("Opened database successfully");
[code]....
Error after running : java.sql.SQLException: database is locked
View Replies
View Related
Jun 23, 2015
This the output of java from my PC under linux platform (rhel 6.5).
[pentaho@vertica-srv1 Downloads]$ java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
[Code] ....
But the problem is while trying to open ETL program under linux platform [pentaho@vertica-srv1 data-integration]$ ./spoon.sh .... I received the following error messages.
[pentaho@vertica-srv1 data-integration]$ ./spoon.sh
Trying to add database driver (JDBC): RmiJdbc.RJDriver - Warning, not in CLASSPATH?
Trying to add database driver (JDBC): jdbc.idbDriver - Warning, not in CLASSPATH?
Trying to add database driver (JDBC): org.gjt.mm.mysql.Driver - Warning, not in CLASSPATH?
Trying to add database driver (JDBC): com.mckoi.JDBCDriver - Warning, not in CLASSPATH?
[KnowledgeFlow] Loading properties and plugins...
View Replies
View Related
Dec 19, 2014
What is correct url to connect to db with orcl SID using IPC protocol? Couldn't find this in documentation....
jdbc:oracle:oci:@[WHAT GOES HERE?]
View Replies
View Related
Jul 10, 2015
I have small Java code, which execute every day and checks for data in database using Cronj Schedular and everything works fine, but recently I have observed that, it is failing due to
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@160.110.xx.xxx:1521/test
At the same time, when I run my test code to check Database connectivity that works fine without above exception. I'm unable to figure it out. Although, there was just slight code change, but that was nowhere related to Database or Database connection.
dbconf.java
public class dbconf {
private Connection connect;
private String connstr;
public Connection getConnection() throws SQLException {
connstr = "jdbc:oracle:thin:@160.110.xx.xxx:1521/test";
[Code] ....
Application Log file
Wed Jul 01 09:25:17 IST 2015:------- Initializing -------------------
Wed Jul 01 09:25:17 IST 2015:------- Scheduling Jobs ----------------
Wed Jul 01 09:25:17 IST 2015:------- Job Started Running ----------------
Thu Jul 02 06:00:00 IST 2015 : Job Executed..!! Bschedularv2.2
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@160.xxx.67.xxx:1521/test
Sat Jul 04 06:00:00 IST 2015 : Job Executed..!! Bschedularv2.2
Sun Jul 05 06:00:00 IST 2015 : Job Executed..!! Bschedularv2.2
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@160.xxx.67.xxx:1521/test
So, you can see, It failed on 3rd of July and 5th July as well. But, in between it ran fine.
View Replies
View Related
Jun 1, 2015
I have a template file which I'm tring to upload into a database using setBlob or setBinaryStream but I'm getting the following error:
java.lang.AbstractMethodError: setBlob
at weblogic.jdbc.wrapper.PreparedStatement.setBlob(PreparedStatement.java:1005)
at com.capitalone.citrix.ssp.dao.KatetDaoImpl.uploadReport(KatetDaoImpl.java:1697)
at com.capitalone.citrix.ssp.services.FileOpsImpl.generateDownload(FileOpsImpl.java:648)
at com.capitalone.citrix.ssp.controller.JSONController.display(JSONController.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[Code] .....
I'm using :
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
Weblogic Server Versions: 10.3.0.0 with Java 1.6.0_05
The driver class name for the weblogic datasource: weblogic.jdbcx.oracle.OracleDataSource
Initially, I tried:
sqlQuery = new StringBuffer();
ps = null;
sqlQuery.append("insert into KATET_REPORTS (FILE_DATA)");
[Code] ....
This failed, so I changed ps.setBlob(1,is)
to
ps.setBinaryStream(1,is). This failed as well with teh same error, just for setBinaryStream instead of setBlob.
Is there a known inconsistency between that driver and this Weblogic version? Is there something else going on? If I haven't given enough data to debug the issue here, what other data should I gather?
View Replies
View Related
Jan 28, 2014
I have a image package consisting of images and they are displayed in a jlabel.I used the code below for that
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
Image im=new ImageIcon(this.getClass()
.getResource("/images/" + imageNames[index])).getImage();
ImageIcon iconLogo = new ImageIcon(im);
jLabel5.setIcon(iconLogo);
}
Now I want to store the image displayed in the jlabel into the database(oracle).From the above code I dont know how to get the absolute path of the images.
View Replies
View Related
Feb 26, 2015
try {
File configFile= new File("C: Documents and SettingsstudentMy DocumentsNetBeansProjectsCDASsrcconfig.xml ");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(fXmlFile);
doc.getDocumentElement().normalize();
NodeList nList = doc.getElementsByTagName("config");
[Code] .....
This code is working properly but i have use path like this
File configFile= new File("srcconfig.xml");
Instead of system directory path i have to use path inside of project but i am getting an error-cannot find the specified file...
View Replies
View Related
May 21, 2014
I am trying to make connection with oracle database but when i run java file it's raise an error
"classnotfoundexception oracle.jdbc.driver.oracledriver"
DriverManager.getConnection(
"jdbc:oracle:thin:@erp:1521:ORCL", "apps",
"apps");
View Replies
View Related
Aug 17, 2014
I am trying to run a simple program that connects to a mysql database and prints out some fields. I am using Eclipse.
THe problem I am having is on the following line of code.
Class.forName("com.mysql.jdbc.Driver");
I get an error:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
[Code] ....
I have done some research and from what I have found is that I need to alter the class path to pick up the driver. When I downloaded the .msi I ran it and then the program closed. Where the files are ??? How to locate and import the file so I need to get my program to run?
I have included all the of the source code below.
package mySQLConnect;
import java.sql.*;
public class Connect {
// JDBC Driver name and database URL
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String BD_URL = "jdbc:mysql://localhost/sstbde";
[Code] .....
View Replies
View Related
Jul 9, 2015
We currently have an application which uses JDBC to connect to the backend database (DB version - 11.2.0.3 ). The application uses a properties file in which the password for the db schema is hardcoded in plain text format. Due to security restrictions we have been asked to make sure the password is encrypted in the file and no direct access is made to the schema using the plain text password. Best options we can use to make this password encrypted both at Oracle DB side and Java side.
View Replies
View Related
May 17, 2014
calling a parameterized stored procedure in java jdbc from sql server.The stored procedure goes like this in sql
create proc patientreg
@id int
as
begin
select [patient_id],[Psurname], [pFirstname], [pMiddlename], [reg_date], [DOB], [Sex], [Phone_num], [Addr],[Email],[dbo].[fncomputeage](DOB) from [dbo].[Patient_registration] where [patient_id] = @id
end
please note dbo.fncompute(DOB) is a function
To call it in jdbc it goes like this
try{
String str = "{call patientreg(?)}";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbcdbc:GeneralHospit al");
cstmt = con.prepareCall(str);
cstmt.setInt(1, Integer.parseInt(t.getText()));
[code]....
after doing it this way it throwing an exception: Error:java.sql.SQLException: Parameter 1 is not an OUTPUT parameter.
View Replies
View Related
Jun 26, 2014
I tried many times to return a string from java project to an android project But it keeps sending incorrect values as in 2 as it should be 1 here is an example.
Java Project:
boolean somethingboolean = false;
if(something.equals("1")){
somethingboolean = true;
}
public static String getString(){
if(somethingboolean == true){
[Code]...
Android project:
System.out.println(JavaProject.getString())
and in the android project it prints "FALSE"
So what should i do?
View Replies
View Related
Apr 18, 2015
Right now it displays a number like this "$25.0" and I want it to display it like this "$25.00" and don't know how to do it.
View Replies
View Related
Apr 30, 2014
I am trying to set a picture in the background of my GUI. I had already made the GUI with the all the required buttons and labels. So I was trying to separately make a class which extends JPanel and add a picture to a panel by overriding the paintComponent() method, and then added it to a frame (I did not set the default layout of the frame, so it was the default...), and it worked very fine. Here is the code:
Java Code:
private BufferedImage image;
public ParentPanel() {
try {
image = ImageIO.read(getClass().getResource("/com/dev_nna/scheduler/UI/1405188.png"));
} catch (IOException ex) {
ex.printStackTrace();
[code]....
Then I needed to add this panel with background picture to the background frame of my already made frame with all the buttons on it.The layout of the parent frame of my GUI was BorderLayout(50, 50), panels (with buttons) were added to it n the north and south positions.
Then I tried to add a JPanel with the background image to the parent frame (of my GUI), (I wanted it to elapse the entire frame, and come under all the buttons and controls, which were only present in the north and south positions of the border layout), and then the panels holding the buttons to the north and south postions of this panel, everything disappeared.
If I don't do anything except adding this panel with the background image to the parent frame, it only takes up the place not taken up by the two panels on the frame (Border Layout)
how to add this panel to the parent frame of my GUI such that it elapses the entire parent frame's background, and the panels containing the buttons should sit on it.
IMPORTANT PARTS OF CODE:-
Java Code:
//TOP LEFT PANEL
JPanel topleftpanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
parentPanel_top.add(topleftpanel);
topleftpanel.setOpaque(false);
[code]....
View Replies
View Related
Jul 20, 2014
I am new to Java. I am from .net background.I am trying to setup Sonar server. In one of our training sessions on Sonar, the instructor did the anaysis of solution using pom.xml file and then calling mvn sonar:sonar. I am trying to replicate the entire setup locally.
1. I installed JRE 7. When I run , java -version, it shows,
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
2. I download sonar 3.5 and extracted it to new folder
3. In that folder I installed sonar-runner 2.4
3. setup the path and sonar_runner environment variable
4. downloaded jtds-1.3.1 and placed the jar file in mssql folder of sonar
5. I create database sonar with username and password as sonar
6. changed sonar-runner.properties for sql server connection
7. changed sonar.properties for sql server connection
8. Ran Sonar.bat and found that it created tables in the sql server db. To me the command prompt seems like it is hanging as after creating table graphs, the last line is
"jvm 1 | 2014-07-20 13:03:34.967:INFO::Started SelectChannelConnector@0.0.0.0:
9000 "
Is it supposed to stay like this always or should i closed this command prompt by pressing CTRL+C?
9. Now when i run mvn-sonar:sonar, it says mvn is not recrognizes as internal or external command. A quick search on google showed that I need to install Apache maven something I belive. What is this or how do I solve this issue so that the command mvn sonar:sonar can work?
10. I would like to use c sharp ecosystem plugin. But when I browse to C# Plugin - SonarQube - Codehaus , I am confused as what to select? i.e. version 3.2, 3.1, 3.0
11. So if I do a system restart and everytime I have to use sonar, should i run sonar.bat and then do mvn sonar:sonar after modifying the pom.xml file?
View Replies
View Related