Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 849099 Details for
Bug 1051349
sql db cannot be connected via java datasource after db cartridge restart on the first time
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
script_to_connect_db
mysql.jsp (text/plain), 1.25 KB, created by
Meng Bo
on 2014-01-13 01:54:11 UTC
(
hide
)
Description:
script_to_connect_db
Filename:
MIME Type:
Creator:
Meng Bo
Created:
2014-01-13 01:54:11 UTC
Size:
1.25 KB
patch
obsolete
><%@ page contentType="text/plain" language="java" import="java.sql.*" %> ><%@ page import="javax.naming.*" %> ><%@ page import="java.io.*" %> ><%@ page import="java.util.*" %> ><%@ page import="java.text.*" %> ><%@ page import="javax.naming.*" %> ><%@ page import="javax.sql.*" %> ><% >String version = request.getParameter("version"); >InitialContext ctx = new InitialContext(); >DataSource ds = (DataSource) ctx.lookup("java:jboss/datasources/MysqlDS"); >Connection connection=ds.getConnection(); >Statement statement = connection.createStatement(); >statement.executeUpdate("CREATE TABLE IF NOT EXISTS factory(id INT UNSIGNED NOT NULL, data TEXT, PRIMARY KEY(id));"); >statement.executeUpdate("COMMIT;"); >ResultSet rscount = statement.executeQuery("SELECT COUNT(*) FROM factory;"); >if(rscount.next()) { > if(Integer.parseInt(rscount.getString(1)) == 0) { > statement.executeUpdate("INSERT INTO factory VALUES(1, '1');"); > } >} >if(version != null) { > statement.executeUpdate("UPDATE factory SET data=" + version + " WHERE id=1;"); > out.print("The mysql factory is modified"); >} >else { > ResultSet rs = statement.executeQuery("SELECT * FROM factory;"); > if(rs.next()) { > out.print("version " + rs.getString(2)); > } >} >statement.close(); >connection.close(); >%>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1051349
:
848263
| 849099